This is very curious code as you we end up creating taxonomies like “product-cat” or “product_cat” so following code come to rescue earlier the URL was
http://34.230.181.212/sr/product_cat/flans/
after using code above it became
http://34.230.181.212/sr/product-category/flans/
function space_change_custom_taxonomy_slug_args( $taxonomy, $object_type, $args ){
if( 'product_cat' == $taxonomy ){
remove_action( current_action(), __FUNCTION__ );
$args['rewrite'] = array( 'slug' => 'product-category' );
register_taxonomy( $taxonomy, $object_type, $args );
}
}
add_action( 'registered_taxonomy', 'space_change_custom_taxonomy_slug_args', 10, 3 );
![Change slug of [Custom Taxonomy] on fronted 1 screen18](https://i0.wp.com/unbeatenwebsolutions.com/wp-content/uploads/2024/07/screen18.jpg?resize=640%2C598&ssl=1)