Custom Taxonomy and Custom Post Type Rewrites
When creating Custom Taxonomies and Custom Post types with rewrite rules in WordPress, the order in which they are registered matters. With the taxonomy registered first, WordPress will be able to work it’s magic for the rewrite rules to work.
// TAXONOMY FIRST $tax_args = array( 'labels' => 'TAX_NAME', 'rewrite' => array( 'slug' => 'CPT/TAX/' ) ); register_taxonomy( 'CUSTOM_TAX_TYPE', 'CUSTOM_POST_TYPE', $tax_args ); // POST TYPE SECOND $cpt_args = array( 'labels' => 'CPT_NAME', 'rewrite => ' array( 'slug' => 'CPT' ) ); register_post_type( 'CUSTOM_POST_TYPE', $cpt_args );Published on June 13, 2017