WordPress parses incoming URLs with a list of regular expressions, the rewrite rules. The first regex that matches the URL “wins”, and determines what kind of query will be executed. You can see the rewrite rules and play with different URLs with my Rewrite analyzer plugin.
Whether or not pages take priority over other rules depends on your permalink structure. If it contains %postname%
, %category%
, %tag%
, or %author%
as the first permastruct, the rewrite engine will generate verbose page rules, where each page gets a specific rule at the top of the list instead of a catch-all rule at the end. This can explain the difference between the two sites.
The WP_Rewrite::rewrite_rules()
function that generates the rules has many different filters. You can hook into one of them to modify the array, so that the most important rules for you are at the top. You can find many questions on this site with examples of how to modify these rules.
Related Posts:
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- Taxonomy archives based on Custom Post Type
- How to achieve this permalink -> category-name/custom-post-type-name/post-name
- Taxonomy page returns 404 page not found
- How to Add Pages Under Custom Post Type URL Structure?
- Prepend meta_value to permalink of post
- Custom Post Type pagination when CPT ‘rewrite’ rule and a page have the same slug
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- Custom post type with slug for plural (archive) and for single
- How do I fix permalinks for custom post types that has the same slug as a page?
- Making a custom help center page
- CPT custom archive template does not get loaded
- Am I using the flush_rewrite_rules function in the right place?
- Adding Post id to the end of slug in a Custom Post Type
- Assign same parrent Page to pages AND custom post types
- How to get list of taxonomy slugs ordered parents>childs?
- Get url.com/post_type/taxonomy/term work!
- Redirect to another page using contact form 7? [closed]
- Rename a slug label
- Changing CPT slug and taxonomy already registered in parent theme
- Custom Post Type with modified permalink structure results in 404
- Under What Conditions Can I name my CPT the same as my CPT Page?
- wp_dropdown_pages with tax_query clause
- Custom permalink structure for custom post types including multiple taxonomy
- Two CPT: one is using part of the custom rewrite slug from the other
- Custom taxonomy archive slug overwrites static page
- Permalinks for a custom post type – with a page template (custom query) and taxonomy archive
- Get the custom post type slug but remove the rewrite prefix?
- How to make nested custom post type slugs work
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- Ideal top-level slug methods
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- Taxonomy Archive URL + Template
- How to change rewrite slug for custom post type without conflicting w/ child pages of page with same slug
- How to get taxonomy category in permalink for each taxonomy OR How to give a parent page to a given taxonomy?
- Front custom edit post page for each post
- How can I use get_post_meta with add_rewrite_rule to build custom permalinks?
- How to build custom route by adding taxonomies to URL ? ex: www.demo.com/communities/palo-alto/
- Remove the parent slug in a CPT URL
- Permalink for a custom post type isn’t working and I don’t know why
- Can’t get custom rewrite tag, query var, permastruct (permalink structure), and rewrite rule to work properly together
- How to Filter custom post type by taxonomy?
- Is it possible to have dedicated page for parent/child taxonomy?
- Trouble with CPT Child 404
- How to target a specific custom post type post and its all children and grandchildren?
- Custom rewrite url category
- Rewrite Question Mark in Post Template to Make it Pretty URL
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Database to page routing API?
- Custom post taxonomies as tax_query terms?
- Get related posts of child term of custom post type
- Limit amount of posts made within a custom taxonomy
- How can achieve this permalink perfectly? domain.com/%category%/%post-name%
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Index page with the same id as the slug
- Custom post type + category archive page
- How can I make the slug of the taxonomy also the slug of the custom post
- Allow duplicate slugs for custom post type with taxonomies
- list taxonomies from a custom post type
- Display a grid of taxonomy terms at root taxonomy page
- Nested Custom Post Type or Custom Post Type Parents?
- Customize Custom Post Type URL
- Show child custom post types list inside single parent custom post type
- Programmatically rewriting slug through functions.php but returns 404
- limit value taxonomy based on previous taxonomy value wordpress
- Allow Static Page Load Dynamic Child Pages
- Create a custom php page and load it at a specific slug
- How do I change the custom taxonomy slug to be the same as the custom post type slug?
- Custom Post Type with Same Page URL
- Several post types on WP Query by tag and taxonomy
- No Permission to add new Page, Post or CPT with Admin role
- Using meta_query and tax_query at the same time
- How do I display the taxonomy for a custom post type in an array
- 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
- How to conditionally redirect to the post from a taxonomy page?
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- How do I display the grand child items of a taxonomy term?
- Taxonomies relations
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Rewrites/query for multiple hierarchical custom post types
- cpt and page sharing same base permalink
- Full Custom Post Type List Organised by two Taxonomies
- How to prevent a CPT’s slug and page slug from conflicting with each other?
- WordPress Doesn’t Generate Taxonomy Archive
- Custom Post Slug same as Parents Category Slug
- Hide or disallow default custom post type url?
- A case for Hierarchical Custom Posts
- Suggested Post and Taxonomy structure
- Static page determines as home, but it is not
- CPT Template Not Showing – Getting 404
- Multiple (two) category postings on the same page.
- Post Type rewrite rule to point to custom Page/template
- Rewrite CPT child page URL to support query var
- Custom post with more than one custom taxonomy
- Removed custom post type slug but not working for child pages
- Show Custom Post Type meta boxes only on Page Edit
- Get the taxonomy of a post hierarchically