Create permalink structure for one taxonomy archive per custom post type

This is very easy to do by adding custom rewrite rules. This should get you started:

add_action( 'init', 'wpse_100386_rewrites' );
function wpse_100386_rewrites() {
    add_rewrite_rule( 'case-studies/room/([^/]+)/?', 'index.php?the_room=$matches[1]&post_type=the_case_study', 'top' );
    add_rewrite_rule( 'videos/room/([^/]+)/?', 'index.php?the_room=$matches[1]&post_type=the_video', 'top' );
}

As always when changing rewrite rules, be sure to flush your rewrite rules by going to Settings -> Permalinks and click “Save Changes”.

Leave a Comment