You don’t need those custom rewrites and term permalink tweaks, so just remove these and the relevant callbacks:
add_action('init','theme_child_custom_rewrite', 1000);
add_filter( 'term_link', 'listing_region_term_link', 1, 3 );
And just use the register_taxonomy_args
hook to override the taxonomy’s parameters:
function override_listing_region_taxonomy_args( $args, $taxonomy ) {
if ( 'listing-region' === $taxonomy ) {
$args['rewrite'] = array(
'slug' => 'region',
);
}
return $args;
}
add_filter( 'register_taxonomy_args', 'override_listing_region_taxonomy_args', 11, 2 );
Things to note:
-
Make sure you flush the permalinks after applying the above code/changes — just visit the permalink settings page (without making any changes or clicking the submit button).
-
You may need to use a greater priority value; e.g.
20
:add_filter( 'register_taxonomy_args', 'override_listing_region_taxonomy_args', 20, 2 );