s_ha_dum’s answer didn’t work for me, but this did:
/**
* Completely disable term archives for this taxonomy.
* @param string $taxonomy WordPress taxnomy name
*/
function kill_taxonomy_archive($taxonomy){
add_action('pre_get_posts', function($qry) {
if (is_admin()) return;
if (is_tax($taxonomy)){
$qry->set_404();
}
}
);
}
Related Posts:
- What is the best practice for displaying my plugin content in themes?
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- How to Use A Custom Post Type as Taxonomy for Another Custom Post Type
- WordPress add taxonomies/terms list as a menu in archive page
- Custom Taxonomy as checkbox or dropdown
- Taxonomy: Why ‘with_front’ => false DOES NOT WORK?
- How to Add Custom Taxonomy To Woocommerce Plugin
- Custom Taxonomy as Dropdown in admin
- Custom taxonomy not showing up when adding a new custom post type
- How to list all categories and tags in a page?
- register_taxonomy with multiple object type and update_count_callback
- Retrieve single term slug
- Create an archive page for custom taxonomies
- How do I list terms of a custom taxonomy at i.e. domain.com/brands/
- Taxonomy-{taxnonomy}.php is not working
- Custom Taxonomy and tax_query Issue?
- Get list of terms of current taxonomy archive for another taxonomy
- Associate Taxonomies Across Post Types
- Use the_taxonomies() to create a simple list
- Listing taxonomies from custom post type
- Show Post Count of a Category
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Relationship between two taxonomies and a custom post type [closed]
- Menu Multiple Taxonomies
- How to make a custom taxonomy selectable in post publish area?
- Metadata for a taxonomy – is there any WordPress way of doing this?
- How do I get array of types associated with a taxonomy?
- wp_get_post_terms on custom post type with custom taxonomies returning an empty array
- How to display custom taxonomies with links in filter menu?
- How to Filter custom post type by taxonomy?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Limit amount of posts made within a custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- list taxonomies from a custom post type
- Set a CPT slug as a base name for all the taxonomies
- How do I display the grand child items of a taxonomy term?
- Taxonomies relations
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Full Custom Post Type List Organised by two Taxonomies
- Adding custom taxonomy in same menu place with two custom post types
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Main query not querying any posts in custom taxonomy template
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- Using page slug in wp_query
- Custom taxonomy (categories) on custom post type return no results
- get_category_link() for custom post type does not include custom slug rewrite?
- Targeting categories in custom fields
- Rewrite custom post type with taxonomy
- My custom taxonomy is only displaying 1 of 3 terms
- Changing CPT slug and taxonomy already registered in parent theme
- Custom Taxonomy Terms in Menu lead to which page?
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Using page title as a link to term archive
- Most viewed post of custom post type
- How to display posttypes and taxonomy in standard posts, not in a separate label?
- Custom post type page with parameter
- “Menu order” being ignored when querying posts from a parent taxonomy with “include_children” set to true
- Custom post type category link redirecting to 404 page
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- Get the taxonomy value in the post loop inside the archive page
- How to show related posts of category on post within custom posttype
- Error 404 change permalink term custom term taxonomy
- I have a random letter appearing before my content. Where to start looking for the cause?
- Custom taxonomy returns 404 even with saving permalinks
- Create custom post type categories
- How to add CSS class field in Custom Taxonomy?
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Set a Default CPT taxonomy by taxonomy id
- Listing all custom posts having a specific taxonomy whatever the terms
- How to manage a dynamic multi-level page hierearchy system?
- Display custom tax in “while” loop
- Categories manage
- Add other all taxonomies as meta boxes to custom post type
- How to get post type archive category title
- I can not call the categories of custom post type
- Showing taxonomies with terms that are attached to custom post
- Which File Populating CPTs in Slug URL
- Custom Taxonomy page redirecting to 404 page
- Changing an item in drop down after 5 latest posts per taxonomy
- Not Able to List CPT Based on Taxonomy Term
- Filter Term By Parent Term – Custom Post Type
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Custom post type taxonomy template and URL confusion
- Custom Taxonomy is disabled on Edit page
- Override “Parent” input for custom taxonomy
- Associate custom categories to different user IDs
- Render custom taxonomy query as single template
- List all posts from custom post type by taxonomy
- Connecting multiple post types? Or linking “News” posts with “Game” posts how?
- Sort by Custom Post Type (Multiple Loop)
- How to display elements of different post types?
- How to display only taxonomies of custom post type in a page?
- Check if taxonomy is attached to at least one post in a post-type
- Looping taxonomy in taxonomy?
- Custom posts and custom taxonomies for many products and categories?
- get_the_term_list() wanting to loop through the returned values
- How do i get the taxonomy term name on the CPT archive page?
- Filtering custom post types using category taxonomy
- Make term slugs of custom taxonomy available in WP REST API for custom post type?