Taxonomy archives based on Custom Post Types
Taxonomy archives based on Custom Post Types
Taxonomy archives based on Custom Post Types
Cannot use dynamic prefix for WooCommerce permalink
Adding Category to Child Posts Permalink
Changing the add_rewrite_rule did the trick: add_rewrite_rule(‘^periodicals/([^/]+)-‘.$tlv[‘code’].'[/]?$’, ‘index.php?periodicals=$matches[1]&post_type=periodicals&name=$matches[1]&mlang=’.$tlv[‘code’], ‘top’); So, I assume for custom post types, using add_rewrite_rule with index.php as query need some extra query variables. A sample will be as: add_rewrite_rule(‘^<custom_post_type>/([^/]+)-‘.$tlv[‘code’].'[/]?$’, ‘index.php?<custom_post_type>=$matches[1]&post_type=<custom_post_type>&name=$matches[1]&mlang=’.$tlv[‘code’], ‘top’);
Get URL parameters with rewrite rules
Display A Post At A URL without Redirecting
Rewrite rule for nested URL does end in 404
Same Custom Post Type Slug and Custom Taxonomy Slug, with hierarchial unique permalink structure
You have just a little mistake in your preg_match, instead of this: if ( preg_match(‘/(year=\$matches|monthnum=\$matches)/’, $rewrite) ) { do this: if ( preg_match(‘/(year=\$matches|monthnum=\$matches\/)/’, $rewrite) ) { I was looking for a solution to clean a lot of rules, this source is useful: https://wpreset.com/remove-default-wordpress-rewrite-rules-permalinks/ My final code is this, it can be customized allowing more or … Read more
How to change rewrite slug for custom post type without conflicting w/ child pages of page with same slug