First, register your taxonomy and set the slug argument of rewrite to shows:
register_taxonomy( 'tour_types', 'tour', array( 'rewrite' => array( 'slug' => 'du-lich', 'with_front' => false ), // your other args... ) );
Next, register your post type and set the slug to shows/%tour_types%, and set has_archive argument to shows:
register_post_type( 'tour', array( 'rewrite' => array( 'slug' => 'du-lich/%tour_types%', 'with_front' => false ), 'has_archive' => 'shows', // your other args... ) );
Last, add a filter to post_type_link
to substitute the show category (types tour) in individual show permalinks
function hdev_show_permalinks( $post_link, $post ){ if ( is_object( $post ) && $post->post_type == 'tour' ){ $terms = wp_get_object_terms( $post->ID, 'tour_types' ); if( $terms ){ return str_replace( '%tour_types%' , $terms[0]->slug , $post_link ); } } return $post_link; } add_filter( 'post_type_link', 'hdev_show_permalinks', 1, 2 );
Forgot the has_archive
argument of register_post_type
above, that should be set to shows
.
Result: