While you’ve found the problem already, here is some basic code to move a specific rule to the end of the rewrite rules with the rewrite_rules_array filter for people stumbling across a similar problem.
Say I want to move the rule for ([^/]*)/([^/]*)/?$
:
add_filter("rewrite_rules_array", function($rules) {
$keys = array_keys($rules);
foreach($keys as $rule) {
if($rule == '([^/]*)/([^/]*)/?$') {
$value = $rules[$rule];
unset($rules[$rule]);
$rules[$rule] = $value;
break;
}
}
return $rules;
});
Note that you’ll need to flush/update the rules for this to have any effect. Saving your permalinks configuration in the backend is enough to accomplish that.
Related Posts:
- Custom rewrite rules for archive page and single post
- WordPress Rewrite Rules for Custom Post Type and Taxonomy
- Custom post type 404s with rewriting even after resetting permalinks
- Multiple post types – share same ReWrite slug?
- How to modify URL structures in custom post types and taxonomies or terms
- Adding meta values to permalink
- Archive page with multiple taxonomies rewrite
- How can i avoid the permalink start with ‘blog’ while using the custom post type?
- Permalinks so that one custom post type appears to be a child of another, not working
- Taxonomy archives based on Custom Post Type
- Change page /2 to /transcript with a Rewrite
- Permalink rewrite with custom post type and custom taxonomy
- Child pages on hierarchical Custom Post Types 404s
- Prepend meta_value to permalink of post
- Rewrite custom post type url’s adding meta box values
- Multiple parameters in a custom post type url rewrite
- Permalinks for CPT breaks permalinks to pages
- WP Rewrite Rules – Custom post type & taxonomy
- Removing CPT slug from URL results in 404 error for archive page
- WordPress monthly archive links result in 404
- Remove base slug in CPT & CT, use CT in permalink
- Custom Taxonomy 404
- WordPress Rewrite rule for nested post types
- Custom Post Type rewrite redirects to homepage
- single-{post_type}.php is not loaded despite flushing rules
- Custom Permalink Tag breaks Pagination
- Adding paged query to custom URL rewrite
- Custom Permalink for Taxonimie and Custom Post Type
- how to get archive urls with same origin for custom types and terms?
- Rewrite numeric ID parameter for hierarchical custom post type
- Customising rewrite rules for CPT single post URL to work as paged URL
- Remove custom post type slug not working for child pages
- How to Combine Two Custom Post Types into Single Permalink Structure
- Pagination problem
- Permalink Structure CPT With Custom Taxonomy Fails
- Making a custom help center page
- Custom taxonomy in URL showing 404
- Remove url rewrites for registered taxonomies
- Rewrite slug of custom post type to include post-id
- How to change custom post type permalink structure
- Front custom edit post page for each post
- How can I use get_post_meta with add_rewrite_rule to build custom permalinks?
- Can’t get custom rewrite tag, query var, permastruct (permalink structure), and rewrite rule to work properly together
- Rewrite Question Mark in Post Template to Make it Pretty URL
- How can achieve this permalink perfectly? domain.com/%category%/%post-name%
- Using taxonomy term in CPT permalink – Pages 404’s
- Customize Custom Post Type URL
- Custom post URL 404 error
- How do I change the custom taxonomy slug to be the same as the custom post type slug?
- Set a CPT slug as a base name for all the taxonomies
- Custom taxonomy rewrite with query var returns %2F in URL
- WP Rewrite Rule Issue while using Custom post type & taxonomy
- Custom Permalinks with CPT and Hierarchical Taxonomies
- Rewrites/query for multiple hierarchical custom post types
- cpt and page sharing same base permalink
- Hide or disallow default custom post type url?
- Post Type rewrite rule to point to custom Page/template
- How to get list of taxonomy slugs ordered parents>childs?
- Rewrite Endpoints and CPTs – How to use in a plugin
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- add_rewrite_rule and passing variables for custom post types
- Pretty URLs and custom post types
- Specific routing for CPT
- Custom rewrite to fetch feed data
- Custom Rewrite Rule for Custom Post Type with URL Param
- WordPress custom slug rewrite
- Custom Permalinks for Custom Post Types
- Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?
- Combine multiple CPT names to create valid permalinks
- Set parent for custom post type archive rewrite url
- Route subpage to Custom Post Type
- How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- Post type Permalink
- WordPress custom permalink and archive link for custom post type
- How to rewrite the post slug of a custom post type post
- rewriterule not working
- Pagination for custom post types – url rewriting
- Modifying rewrite rules to use /category//
- Add Custom Values to Permalinks Through Custom Fields and Posts
- Custom Post Type Date Based Archive URL rewrite [duplicate]
- Rewrite rules for custom post type
- Custom taxonomy and post type rewrite rules
- page not found for example.com/custom-post-name
- Paging not working for hierarchical custom post type
- redirect old post type url to new structure url
- Archive page for a custom post type using WPML
- Why won’t this rewrite rule work?
- Parent cpt/child custom post type URL permalink relationship
- Rewrite Rule & Regex – Extract ‘cat-name’ and ‘page-number’ from http://domain.com/custom-post-type/category/cat-name/page/page-number
- rewrite rules add a folder in the path
- Custom Taxonomy in Permalink from post type
- Custom post type permalink structure
- 404 Error On Custom Taxonomy Pages 2, 3, etc
- add_rewrite_rule not working in Custom Post Type UI Plugin
- Custom archive URL as a subfolder of the custom post type slug
- What is the best way to relate different custom post types?
- Remove date rewrite rule for custom post type archive page
- How to add random prefix (based on related page slug) to custom post type?
- Rewrite taxonomy permalink appended to CPT archive url