You can use the rewrite
parameter to customize the taxonomy permalinks.
Here’s an example which links the taxonomy to the default post
post type:
register_taxonomy( 'video_category', 'post', [
'public' => true,
'rewrite' => [
'slug' => 'videos/category',
],
// ... your other parameters ..
] );
Don’t forget to flush the rewrite rules — just visit the permalink settings admin page.
And if the taxonomy is being registered by a plugin and (just in case) it doesn’t allow changing the rewrite slug, there’s a filter hook you can use to change the slug programmatically: register_taxonomy_args
. Here’s a simplified example:
add_filter( 'register_taxonomy_args', 'my_register_taxonomy_args', 10, 2 );
function my_register_taxonomy_args( $args, $taxonomy ) {
if ( 'video_category' === $taxonomy ) {
$args['rewrite'] = (array) $args['rewrite'];
$args['rewrite']['slug'] = 'videos/category';
}
return $args;
}