How to hide custom taxonomy archives same way as hiding custom post types?

I’m trying to make it so my custom taxonomy terms don’t have archive pages. I achieved something similar for a custom post type using “publicly_queryable’ => false”. I tried this from the docs inside the register_taxonomy function:

'public' => false,
'rewrite' => false,

Which works.. but it also removes the ability to view the taxonomy from anywhere in the dashboard.

1 Answer
1

If you set public to false, this taxonomy will get hidden in all places.

So if you want it to be visible in wp-admin, you’ll have to also set show_ui to true – it will show the admin interface to manage this taxonomy.

You can see the full list of params here:
https://developer.wordpress.org/reference/functions/register_taxonomy/

And here is a generator, that may be a nicer way to create code for registering taxonomies/posts:
https://generatewp.com/taxonomy/

Leave a Comment