yes, possible to achieve the URL structure you desire by modifying the permalink structure for your custom post type and taxonomy.
Firslty flush the rewrite rules by visiting the permalink settings page in your Wp admin area Settings > Permalinks
and clicking Save Changes
. This will regenerate the rewrite rules and apply your custom permalink structure.
After adding the below code in your current active theme functions.php
file or your custom plugin.
Remove treatment_category
from the category URL
add_action('init', 'custom_taxonomy_rewrite_rule');
function custom_taxonomy_rewrite_rule() {
$taxonomy_slug = 'treatment_category'; // Change this to your taxonomy slug
$taxonomy = get_taxonomy($taxonomy_slug);
$taxonomy->rewrite['slug'] = ''; // Set the slug to empty to remove "category" from the URL
}
Remove treatment
from the post URL
add_action('init', 'custom_post_type_rewrite_rule');
function custom_post_type_rewrite_rule() {
$post_type_slug = 'treatment'; // Change this to your custom post type slug
$post_type = get_post_type_object($post_type_slug);
$post_type->rewrite['slug'] = ''; // Set the slug to empty to remove "treatment" from the URL
}