Try something similar to this:
function custom_rewrite( $wp_rewrite ) {
$feed_rules = array(
'(.+)/([^/]+)(/[0-9]+)?/?$' => 'index.php?post_type=".$wp_rewrite->preg_index(1)."&custom_taxonomy='. $wp_rewrite->preg_index(2).'&post_name=". $wp_rewrite->preg_index(3)
);
$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
}
// refresh/flush permalinks in the dashboard if this is changed in any way
add_filter( "generate_rewrite_rules', 'custom_rewrite' );
You may need to modify the regex, as regex isn’t one of my strongpoints, and you’ll need to swap out your taxonomy name in the URL. You may want to hardcode the custom post type too and adjust the rest accordingly to avoid clashes.
Related Posts:
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- Taxonomy, Terms, and Template Files
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- Adding meta values to permalink
- Hierachical Custom post types permalinks not working
- Custom Posttype Inheritance (and url structure)
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- Can you have two CPTs with the same permalink structure?
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Permalinks using event date (year & month) instead of publication date
- Custom taxonomy & post slug permalink
- Permalink Structure problem with cpt and custom taxonomy
- how to use two permalinks for one custom post type
- Custom Taxonomy List links being re-written
- Custom Post Types, Custom Taxonomies and Permalinks ?
- Writing Custom Rewrite Rules that Incorporate Category for Custom Post Types?
- Custom Permalink Tag breaks Pagination
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- Custom Permalink for Taxonimie and Custom Post Type
- Custom post type hierarchical permalinks not behaving as expected for parent/child pages
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Custom post type and taxonomy permalinks – Structure
- Custom Post Type and Custom Taxonomy Permalinks
- Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure
- How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?
- Automaticly add slug to posts
- Custom post type, permalinks & pagination, going wrong
- remove permalink “front part” for custom post type
- Change Permalink Structure for Tag.php template
- Remove post type slug of all post types from permalinks
- Add archive slug to default post post type
- Custom Post type and permalink settings
- add category name to permalinks on product page /category-name/product-name
- WordPress add_permastruct unwanted matches
- WordPress Custom Post Type Repeated 404 Errors
- Child post with numeric only slug keeps redirecting to parent
- Permalink for a custom post type isn’t working and I don’t know why
- Add custom post type settings to wordress default posts
- Assign same parrent Page to pages AND custom post types
- Remove CPT name from permalink but add %category% instead
- Custom taxonomy returns 404
- Removing Custom Permalink Structure for Custom Post Type
- Use the same date-based permalink structure for all post types
- permalink /category/post-name with custom post type and taxonomy
- “Post name” permalink returns home page for custom posts
- Flush Rewrite Rules when new site is created on network
- Pretty URLs and custom post types
- How to make permalink structure %category%/%postname%/ work for custom post type?
- Lost of query parameter when using permalink
- Different results between permalink and query var search
- Custom post type Permalinks with hierarchical Taxonomies
- Can’t use pagination with custom taxonomy
- make permalink go to a custom single.php file
- Post URL based on Custom Post Types variables
- Dynamic CPT permalink structure based on ACF field value
- Custom permalink not working and showing 404 page not error
- get the permalink never return with empty value
- Redirect User From Registration Page To CPT (profile page) with custom url
- Custom Post Type Archive template not being called
- Custom Post Types,Permalink and Heirarchy
- Passing variables through permalink structure in custom post types
- Custom post type 404 error on “default” or “numeric” permalinks
- add_query_arg() for custom post type on all visible links
- Permalinks for single-[custom-post-types] not working
- Permalink Trouble with custom post types
- Custom Post Type – Main page for certain posts
- Custom post type permalink structure to include the taxonomy
- Custom Post Type permalink doesn’t match post permalink
- Custom post type, permalink, add query variables problem
- Disable permalinks, but allow RSS feeds
- CPT permalinks Rewrite
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Set priority to permalinks
- Modify category permalink to use post type slug
- Changing CPT permalink
- CPT relations use in permalinks under single post type
- Custom Post Type Single Page and Archive Page redirects to Home Page
- Missing permalink for custom post type
- How to change URL structure for custom post type in wordpress? Custom taxonomy + custom Post name [duplicate]
- hierarchical Custom post type child permalink not found
- Remove CPT Slug with 2 taxonomies and 1 post meta
- Custom post type and taxonomy same slug
- How to structure a website with custom post types and custom taxonomies?
- Allow duplicate permalinks slugs for custom posts by different authors
- WordPress page not showing up – replaced with last 10 posts?
- Creating custom post type relationships
- Change wordpress url permalink structure to show authors posts
- Custom Post type and Taxonomy in post URL error
- Custom Post Type + Category archive
- Multiple Custom Post Type permalink issue
- Custom Post Types and rewrite rules – One CPT works and a cloned one doesn’t
- How to retrieve the permalink for a specific (custom) term?
- Permalink Trouble with Custom Post Type
- What is the proper way implement a global $wp_rewrite?
- How can you preserve URLs when moving posts to a custom post type?
- Dynamically change Custom Post Type Template OR Change Permalink?
- 404 Error On Custom Taxonomy Pages 2, 3, etc
- Custom post type with custom parent prefix slug