Hello,
You can try to use next code in your child theme functions.php. Note, that after adding the code you need to save permalinks from site dashboard to apply permalink changes.
add_filter('ba_destinations_rewrite_rules', 'ba_destinations_rewrite_rules', 10, 1);
function ba_destinations_rewrite_rules($rewrite_rules) {
$taxonomy_slug = 'ba_destinations';
$taxonomy_new_slug = 'destinations';
$rewrite_rules = [];
$rewrite_rules[$taxonomy_new_slug.'/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?'.$taxonomy_slug.'=$matches[1]&feed=$matches[2]';
$rewrite_rules[$taxonomy_new_slug.'/([^/]+)/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?'.$taxonomy_slug.'=$matches[1]&feed=$matches[2]';
$rewrite_rules[$taxonomy_new_slug.'/([^/]+)/embed/?$'] = 'index.php?'.$taxonomy_slug.'=$matches[1]&embed=true';
$rewrite_rules[$taxonomy_new_slug.'/([^/]+)/page/?([0-9]{1,})/?$'] = 'index.php?'.$taxonomy_slug.'=$matches[1]&paged=$matches[2]';
$rewrite_rules[$taxonomy_new_slug.'/([^/]+)/?$'] = 'index.php?'.$taxonomy_slug.'=$matches[1]';
return $rewrite_rules;
}
add_filter( 'term_link', 'ba_destinations_term_permalink', 10, 3 );
function ba_destinations_term_permalink( $url, $term, $taxonomy ){
$taxonomy_name = 'ba_destinations'; // your taxonomy name here
$taxonomy_slug = 'ba_destinations'; // the taxonomy slug can be different with the taxonomy name
// exit the function if taxonomy slug is not in URL
if ( $taxonomy !== $taxonomy_name || strpos($url, $taxonomy_slug) === false ) {
return $url;
}
$url = str_replace('/' . $taxonomy_slug, '/destinations', $url);
return $url;
}
—
Best Regards,
Booking Algorithms team