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
- 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
- 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
- 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
- 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 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
- 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
- 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
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- Post type Permalink
- WordPress custom permalink and archive link for custom post type
- 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
- Url Rewriting a dynamic wordpress page with parameters
- Remove cpt slug from url and use custom taxonomy instead breaks all other cpt
- multiple URLS for the same page
- How to properly set the rewrite rules for this case?
- Sudden 404 pages on product category archives
- Change CPT permalink to use the category
- add_rewrite_rule wordpress ignoring url pattern, wp rewrite not working
- How to fix 404 on post after prepending Custom Post Type url with Custom Taxonomy Term slug
- Custom Post Type parent/child relationship rewrite rules for permalinks
- Redirect Custom Post Type from Child Taxonomies
- Rewrite URL of Specific Post of Custom Type
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- Custom post type rewrite and wp_pagenavi interfering with each other
- Custom Post Type Rewrite – Page Not Found
- Custom Post Type rewrite url to /category/pagetitle [duplicate]
- WordPress custom post type rewrite rule matches all pages returning 404
- 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 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?