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
- Rewriting a custom-post-type permalink with taxonomy term?
- Custom Post Type Permalink / Rewrite not working immediately
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- Taxonomy, Terms, and Template Files
- custom post type and custom taxonomy permalink
- Templates for Custom Post Types and Custom Taxonomies
- Hierachical Custom post types permalinks not working
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- Create permalink structure for one taxonomy archive per custom post type
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- Custom permalinks
- Understanding Permalinks on Custom Post Types
- Add links to post categories and taxonomies in wysiwyg link modal?
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Custom Permalinks for Custom Post Types and Taxonomies
- Custom taxonomy & post slug permalink
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Custom post type category, taxonomy and URL rewrite problem
- Define permalinks for custom post type by taxonomy in WP 3.4
- Custom Taxonomy List links being re-written
- Remove taxonomy slug when not assigning taxonomy with custom post types
- Custom Post Type: How to display all of same taxonomy?
- Custom Post Types, Custom Taxonomies and Permalinks ?
- Custom Taxonomy 404
- Remove “-2” from a Toolset Types URL with the same post name
- Add the .html extension to custom post types
- Custom Permalink Tag breaks Pagination
- Custom Permalink for Taxonimie and Custom Post Type
- Programmatically adding posts
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- multiple url slug for single custom post type
- Custom post type and taxonomy permalinks – Structure
- Custom Post Type and Custom Taxonomy Permalinks
- Custom post types, taxonomies, and permalinks
- How to specify URLS for custom posts & taxonomies
- Permalinks not working for custom taxonomy on custom post type
- Permalink Structure CPT With Custom Taxonomy Fails
- Change Permalink Structure for Tag.php template
- Wrong request query on cpt and tax
- Custom Post Type permalink shows wrong page: homepage/index.php
- Custom post type url with category
- Adding custom post category slug in permalink causes 404 error for pages and posts
- Custom post URL 404 error
- How to have this permalink structure: post_type/postname/custom_inner_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)
- permalink /category/post-name with custom post type and taxonomy
- Custom post type and taxonomy permalinks
- 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
- Custom post type pagination 404
- Best way to specify “article type” in URL
- Template files for Custom Post Type and Taxonomy
- Can’t use pagination with custom taxonomy
- Custom taxonomy page returns 404
- Custom post type permalink returns 404 when set to private
- Custom post type slug 404
- How to get all posts related to particular category name on button click?
- Post type Permalink
- Custom post type categories gives 404 error
- Enabling permalinks disables custom page template
- Using page title as a link to term archive
- Permalink Trouble with custom post types
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Set priority to permalinks
- Error 404 change permalink term custom term taxonomy
- Changing CPT permalink
- Custom taxonomy returns 404 even with saving permalinks
- Custom post shows 404 after theme change
- How to change URL structure for custom post type in wordpress? Custom taxonomy + custom Post name [duplicate]
- 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?
- Making permalink for custom post type/custom taxonomy. Stuck with 404 in the single post
- Pretty permalink structure with multiple (AND OR) taxonomies
- What am I doing wrong with my taxonomy?
- Custom Post Type Taxonomy – Permalinks generating, but posts not found
- Custom Post type and Taxonomy in post URL error
- How can I add a “fake” parent into the permalink?
- How to retrieve the permalink for a specific (custom) term?
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- WordPress Custom Permalink Structure with Custom Post Type and Taxonomies
- Add taxonomy to custom post type archive
- Permalinks Works for Custompost type but not with pages Why?
- Problem with Custom Post Types, Taxonomy, permalink, Archive
- Modify permalink of CPT archive to support two taxonomies
- Permalinks for Custom Post Types and Taxonomies