Hello, OnlyCBD,
Thank you for reaching out to us. To remove the brand from the URL, you need to add the following code to the functions.php file of your child theme:
// Remove /brand/ prefix from brand taxonomy URLs
function custom_brand_rewrite_rules($flash = false) {
$taxonomy = 'brand';
$terms = get_terms($taxonomy, array('hide_empty' => false));
foreach ($terms as $term) {
add_rewrite_rule(
$term->slug . '/?$',
'index.php?' . $taxonomy . '=' . $term->slug,
'top'
);
}
if ($flash) {
flush_rewrite_rules(false);
}
}
add_action('init', 'custom_brand_rewrite_rules', 10, 0);
function custom_brand_term_link($termlink, $term, $taxonomy) {
if ($taxonomy === 'brand') {
return home_url('/' . $term->slug . '/');
}
return $termlink;
}
add_filter('term_link', 'custom_brand_term_link', 10, 3);
After that, go to Settings > Permalinks.
Click the “Save Changes” button to flush the rewrite rules and apply the changes.
If you need further assistance or have any questions, please feel free to contact us.
Best Regards,
8Theme’s Team















