The slug of a CPT can not be dynamic (actually no slug can be) as wordpress needs to know how to parse the URL very early in the handling of the request. You can probably change the behaviour, but you will only end with the same results that slugs have to be constant even when you implement your own parsing.
This is why your remove_cpt_slug
generates the url you expect but wordpress fails to handle it correctly.
Related Posts:
- Custom taxonomy in URL showing 404
- Using taxonomy term in CPT permalink – Pages 404’s
- Mixing custom post type and taxonomy rewrite structures?
- Rewriting a custom-post-type permalink with taxonomy term?
- How to remove slug from hierarchical custom types in 3.5.2
- Custom post type permalink: only use %post_id% and remove %postname%
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- 404 on child page when parent page slug is identical to custom post type
- Using /%postname% for a custom post type
- Changing the URL Structure of a Paginated Custom Post
- Adding meta values to permalink
- rewrite get parameter with custom post type
- Hierachical Custom post types permalinks not working
- How can i avoid the permalink start with ‘blog’ while using the custom post type?
- Custom Posttype Inheritance (and url structure)
- Permalinks so that one custom post type appears to be a child of another, not working
- Create permalink structure for one taxonomy archive per custom post type
- Custom permalinks
- Custom post type permalink changing itself every other change
- Custom post type’s get_permalink returns wrong url
- Prepend meta_value to permalink of post
- Custom Permalinks for Custom Post Types and Taxonomies
- Removing parent slug from URL on custom post type
- Including two taxonomies in a permalink structure
- WP Rewrite Rules – Custom post type & taxonomy
- URL rewrite and navigation structure for wordpress custom post type
- Removing CPT slug from URL results in 404 error for archive page
- Remove base slug in CPT & CT, use CT in permalink
- Custom post type category, taxonomy and URL rewrite problem
- Permalink Structure problem with cpt and custom taxonomy
- how to use two permalinks for one custom post type
- Rewrite on custom post type permalink not working?
- Custom Taxonomy 404
- Custom Permalink Tag breaks Pagination
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- Custom Post Type rewrite rules not working, how to alter the rewrite order?
- Custom Permalink for Taxonimie and Custom Post Type
- Permalinks for Taxonomy and Custom Post Type
- Share parent path between Custom Post Types and Pages?
- multiple url slug for single custom post type
- Custom Post Type and Custom Taxonomy Permalinks
- Change URL of posts and also Custom Post Type
- remove permalink “front part” for custom post type
- Permalink Structure CPT With Custom Taxonomy Fails
- Change Permalink Structure for Tag.php template
- Bizarre Permalinks Issue: 404 Errors Everywhere
- Making a custom help center page
- Add archive slug to default post post type
- Custom Post type and permalink settings
- Rewrite rules for custom posts types
- Adding custom post category slug in permalink causes 404 error for pages and posts
- 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 to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- WordPress custom post type permalink rewrite shows page not found
- Custom post type as home page with custom url
- Customize Custom Post Type URL
- Custom post URL 404 error
- URL rewrite add author as base
- Set a CPT slug as a base name for all the taxonomies
- Custom Permalinks with CPT and Hierarchical Taxonomies
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Custom taxonomy returns 404
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- CPT’s with landing page instead of archive – Url Rewrite?
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- Hierarchical permalinks for custom post type and taxonomy
- Pretty URLs and custom post types
- Lost of query parameter when using permalink
- Custom permalink with child taxonomy terms
- 404 in custom post type feed with mistake permalink
- How to solve this custom post type goes to 404 page?
- Best way to specify “article type” in URL
- Problems with 404, .htaccess, permalinks and WordPress custom posts locally on Snow Leopard
- How to have permalink like domain.com/term/postname?
- Set parent for custom post type archive rewrite url
- Custom post type permalink returns 404 when set to private
- Dynamic CPT permalink structure based on ACF field value
- Custom post type slug 404
- How to filter a custom post type by custom taxonomy without 404
- WordPress custom permalink and archive link for custom post type
- Permalink Trouble with custom post types
- Custom Post Type Child Won’t Come Through With Pretty Permalinks
- custom posts permalinks url rewriting
- Adding /blog in front of single posts (only)
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Custom post shows 404 after theme change
- How can I get custom post types to recognize pretty permalink variables?
- Enabling hierarchical in a Custom Post Type gives error 404
- Standard Page Child of CPT Not Found (404)
- Custom post type with parent page? Possible?
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Custom Post Type – Rewrite slug [duplicate]
- How can you preserve URLs when moving posts to a custom post type?
- Rewrite rules for using the same base slug for multiple content types
- Custom post type permalink structure
- 404 Error On Custom Taxonomy Pages 2, 3, etc
- What is the best way to relate different custom post types?
- Allow child pages with the same base as the CPT slug