When you want to use a taxonomy inside a custom post type URL hierarchy, you have to register it BEFORE the custom post type. Otherwise it won’t work properly. here is a short example:
function so305901_register_taxonomies() {
$args = [
//your settings
];
register_taxonomy( 'taxonomy_slug', ['custom_post_type_slug'], $args );
}
add_action( 'init', 'so305901_register_taxonomies' );
function so305901_register_custom_post_types() {
$args = [
//your settings
'taxonomies' => [
'taxonomy_slug'
],
];
register_post_type( 'custom_post_type_slug', $args );
}
add_action( 'init', 'so305901_register_custom_post_types' );
Related Posts:
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- custom post type and custom taxonomy url conflict
- Custom taxonomy in URL showing 404
- Custom post type permalink tag 404
- Hierarchical permalinks for custom post type and taxonomy
- How to solve this custom post type goes to 404 page?
- Safe to throw 404 error in request filter?
- 404 Error On Custom Taxonomy Pages 2, 3, etc
- Adding custom post category slug in permalink causes 404 error for pages and posts
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- How to have the same url structure for both a CPT and a Taxonomy?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- custom-taxonomy/post_name instead of the default post_type/post_name
- Show custom post archive when custom post not specified
- Show custom post type relationships by taxonomy
- Can’t remove front from permalinks for custom taxonomy category page
- Using taxonomy term in CPT permalink – Pages 404’s
- Removing custom post type slug from URL
- Customize Custom Post Type URL
- Custom post URL 404 error
- Permalinks /country/city/cpt/postname/
- Seamless permalinks between Custom Taxonomy and Custom Posts
- Custom post type and custom taxonomy with the same slug using the file page taxonomy only as directory
- Custom Permalinks with CPT and Hierarchical Taxonomies
- How to have this permalink structure: post_type/postname/custom_inner_page
- 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
- Permalinks: custom post type -> custom taxonomy -> post
- Custom post type archive pagination 404
- CPT’s with landing page instead of archive – Url Rewrite?
- How to change permalink to include custom post type
- Custom post type, permalinks, taxonomies and blog posts
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- permalink /category/post-name with custom post type and taxonomy
- Custom post type and taxonomy permalinks
- set permalink for CPT
- Top Level pages in wordpress giving 404, but child pages working fine
- Custom permalink with child taxonomy terms
- Custom post type Permalinks with hierarchical Taxonomies
- 404 in custom post type feed with mistake permalink
- Custom post type pagination 404
- Best way to specify “article type” in URL
- Template files for Custom Post Type and Taxonomy
- Problems with 404, .htaccess, permalinks and WordPress custom posts locally on Snow Leopard
- Can’t use pagination with custom taxonomy
- Custom taxonomy page returns 404
- Template for custom post type when taxonomy is in the URL
- One Custom post type 404’s others don’t
- Permalink problems with custom post type and custom taxonomy
- Custom taxonomy template list not working (404)
- Custom post type permalink returns 404 when set to private
- Custom Post Type Advanced Slug
- Custom post type slug 404
- How to get all posts related to particular category name on button click?
- Post type Permalink
- WordPress custom permalink and archive link for custom post type
- Custom post type categories gives 404 error
- Ideas on how to organize a project [closed]
- Enabling permalinks disables custom page template
- Change permalinks for custom post type based on taxonomy term
- Using page title as a link to term archive
- Custom post type category permalinks and archive pages
- Permalink Trouble with custom post types
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- Permalinks not working (404) for the ‘item’ post type
- Custom category URL not displaying posts
- Multiple permalinks for a single post with multiple taxonomies
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- Custom Post Type Child Won’t Come Through With Pretty Permalinks
- Duplicate slug/permalink issue while adding same post name
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Set priority to permalinks
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Error 404 change permalink term custom term taxonomy
- How to prefix custom post type URL with custom post taxonomy term?
- How do you create pillar content pages?
- Changing CPT permalink
- Custom taxonomy returns 404 even with saving permalinks
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- Changing permalink of default Post with custom post
- Custom Taxonomy Archive generates 404
- 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
- Custom post type single with custom URL structure
- Standard Page Child of CPT Not Found (404)
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- Customise Permalink Structure For Custom Post Types
- How to change URL structure for custom post type in wordpress? Custom taxonomy + custom Post name [duplicate]
- % encoded URL giving 404 error in WordPress
- Remove CPT Slug with 2 taxonomies and 1 post meta
- Custom post type and taxonomy same slug
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- How to create a permalink structure with custom taxonomies and custom post types
- How to structure a website with custom post types and custom taxonomies?