Completely Disable Categories, Post Tags, or Any Other Taxonomy on Your WordPress Site in a Snap

WordPress’ built-in taxonomies (categories and tags) are pretty useful if you’re running a blog, and each taxonomy can serve a distinct purpose in making it easier for your users to find content that interests them. That said, there may be instances where you don’t want to use one of those taxonomies on your website. Maybe you want to remove categories or tags from your site altogether.

I am not talking about removing individual categories or tags from your site, nor hiding a list of categories or tags from your front-end display. Those things should be easy enough, and you can probably find a good tutorial elsewhere. Here, I’m talking about completely removing the taxonomy itself from your site. In other words, there will no longer be such a thing as “categories” or “tags” for your posts (depending on which taxonomy you choose to eliminate).

You could simply ignore the “Categories” and/or “Tags” boxes on the right side of your post edit screen, of course. But maybe you’re working on a client project that doesn’t require post tags, and you’d like to make the admin interface as clean as humanly possible. Or perhaps you’re just a neat freak and don’t want an unused “categories” section cluttering up your backend. Not to worry.

In such a case, all you need to do is write a function that calls Wordpress’ built-in (but little known) unregister_taxonomy_for_object_type() function, and then tie your function into WordPress’ “init” hook (to ensure it gets called at the right time).

The full code is as simple as this:

 * Get rid of tags on posts.
function ryanbenhase_unregister_tags() {
    unregister_taxonomy_for_object_type( 'post_tag', 'post' );
add_action( 'init', 'ryanbenhase_unregister_tags' );

It’s important to note that you must supply your correct taxonomy name here. I’m using “post_tag” in my example, but you could also use “category” (or, really, the name of any other taxonomy that may be present on your site). You must also supply the correct post type name (in my case, “post”).

It’s also best to put this inside a site-specific plugin, but your theme’s functions.php file will do just fine in a pinch.

The great thing about this is that it disables the taxonomy completely for the specified post type, rather than simply hiding a meta box or other administrative elements. In other words, it’s the “right” way to hide unwanted admin elements related to unused taxonomies, because instead of just removing a meta box or hiding something with CSS, you’re actually “unplugging” the functionality itself. Just make sure that’s really what you want to do!