Plugin Improvements
-
Nice plugin you have. I personally tried the well-known first (big number of usage per month) but no luck with setting custom permastruct etc.. If I set one to work, the other post types would 404.
And yes, I’ve flushed permalinks each time.
This one works! Good job.
However, I have a small improvement request looking at the both
rewirites.php
files (post types and terms):As this plugin writes in .htaccess file to 301 redirect by Custom Post Type slug for Post Types, and Custom Taxonomy slug for Terms, wouldn’t it be better to just write 1 regex per CPT and 1 regex for Custom Tax instead of going
foreach
?What do I mean?
functions/posttypes/rewrites.php line 55
If for example CPT name is book, replace foreach statement with:
$content .= ' RewriteRule ^book/$ // [R=301,L]' . PHP_EOL;
It does the same thing as your foreach statement but instead of writing (in my case) 11000+ lines (that’s how many posts I have and growing) it would write just 1 line.
Same goes for Custom Taxonomies.
functions/terms/rewrites.php line 59
should be:
$content .= ' RewriteRule ^book_category/$ // [R=301,L]' . PHP_EOL;
Writing foreach has other disadvantages such as deployment processes, .htaccess on live site being overwritten, websites running on Docker containers etc..
Do you think you could make this small improvement on your plugin?
Thanks.
- The topic ‘Plugin Improvements’ is closed to new replies.