Hello. Thank you for contacting the Toolset support.
You can disable the taxonomy archive by adding the following code to your theme's functions.php file:
add_action('pre_get_posts', 'kill_taxonomy_archive');
function kill_taxonomy_archive($qry) {
if (is_admin()) return;
if (is_tax('tax-slug')){
$qry->set_404();
}
}
Where:
- Replace 'tax-slug' with your original taxonomy slug
Just wanted to confirm that this code will also disable the individual taxonomy pages as well?
Eg. If I have a taxonomy with the following slug 'career-department' and the category 'support-staff'. Will that code prevent both these pages from being created?
I do not see you can access the taxonomy archive with archive slug: /career-department
For the following case:
/career-department/support-staff
if you have added the code as given under:
add_action('pre_get_posts', 'kill_taxonomy_archive');
function kill_taxonomy_archive($qry) {
if (is_admin()) return;
if (is_tax('career-department')){
$qry->set_404();
}
}
It will display 404 page for all the category/terms belongs to taxonomy career-department.