WordPress Rewrite Issue

The rewrite rules are wrong. For example, you want to rewrite from community/tag/easter to ‘index.php?pagename=community&stencil-tag=easter’, so the regex should contain community/tag/ and not only tag/. Also, \d match only digits but the tag value is a string. Same apply to the rewrite for stencil-tag. You could use . to match any character, both numeric and … Read more

WordPress Taxonomy Permalinks – Custom?

Natively every post in WordPress has one specific permalink (if any and not counting non–pretty arguments–based shortlinks). This makes sense not just to WordPress, but also to other entities like people and search engines. It is certainly possible to make additional URLs to load posts in WP too. However it won’t help you any with … Read more

Hierarchical taxonomy in permalink structure

Add the value you want before the “meaningful” url variables (city, area, etc) to the slug like this: “uk/([^/]*)/([^/]*)/?$” => ‘index.php?city=$matches[1]&area=$matches[2]&something=$matches[3]’, This way it will only “capture” those URL variables (city, area) if “uk” is at the beginning. A more complete example might look like this //Set up the additional values in the “rewrite rules” … Read more

How to switch from custom post type URL to category URL?

Your best bet will be a bunch of apache rewrite rules. Place something like this above the # BEGIN WordPress line in your .htaccess file: <IfModule mod_rewrite.c> RewriteRule ^subdirectory/(.*)$ /anotherdirectory/$1 [R=301,NC,L] </IfModule> So, using your example of redirecting /review to /reviews: <IfModule mod_rewrite.c> RewriteRule ^review/(.*)$ /reviews/$1 [R=301,NC,L] </IfModule> You can put as many rules as … Read more

Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/

That happens because WordPress reads your old post name as category name now – and it cannot find that category. Solution: filter 404_template and try to find the post and its permalink. Then redirect. <?php # -*- coding: utf-8 -*- /* Plugin Name: Redirect to category */ add_filter( ‘404_template’, ‘t5_redirect_to_category’ ); function t5_redirect_to_category( $template ) … Read more