Set your taxonomy slug to taxonomy_name
and in your post type set the slug to taxonomy_name/%taxonomy_name_term%
and flush rewrite rules (simply by going to permalink settings panel in the admin) And after that WordPress will be able to handle /taxonomy_name/%taxonomy_name_term%/post-name/
URLs.
So all that is left to do is tell WordPress what %taxonomy_name_term%
means and for that just add this function to your theme’s functions.php file:
add_filter('post_type_link', 'events_permalink_structure', 10, 4);
function events_permalink_structure($post_link, $post, $leavename, $sample)
{
if ( false !== strpos( $post_link, '%taxonomy_name_term%' ) ) {
$event_type_term = get_the_terms( $post->ID, 'TAXONOMY_NAME' );
$post_link = str_replace( '%taxonomy_name_term%', array_pop( $event_type_term )->slug, $post_link );
}
return $post_link;
}
Make sure you replace TAXONOMY_NAME
with the actual name of the taxonomy.