Hide Categories in WordPress Admin Post Editor – Exclude or Remove

WordPress offers hooks to exclude or hide categories from the Post Editor in the admin area. You can remove the category meta box as well. Hiding categories with CSS is also possible. Here I will tell you different ways to hide categories in WordPress Admin Post Editor.

Years ago we used to write on one PHP framework that we have left working in present. So we didn’t want to post further articles in that framework as well as needed to hide them from the category meta box.

Hide Categories in WordPress Admin Post Editor

However, we didn’t want to stop them from appearing on public pages. So we searched on Google and came here with few code snippets to exclude or remove the categories. I’m mentioning them in the article here.

Hide Categories with CSS

It’s a CSS rule and adds the display:none; rule on post.php and post-new.php pages. Since it’s a CSS so you should be aware that the logged-in person can alter the CSS in the browser console.

Also visit: Remove menu items from WordPress Admin.

Exclude Categories in the Add New/Edit Post Screen

This is the function we had used. Add the following function either in the functions.php file of your theme or the plugin.

Here we’re first checking if current admin page is either post.php or post-new.php, using WordPress $pagenow global variable. If it is then we have modified the query using a NOT IN SQL clause to exclude categories by slugs. Add as many as category slugs inside the clause and those categories won’t appear in the category meta box.

Remove the Category/Tag Meta Boxes from the WordPress Post Editor

The remove_meta_box() WordPress Use the code snippet above to completely remove the Category/Tag Meta Box from the WordPress Post Editor screen. Also, replace the second parameter with the custom post type to hide Meta Boxes for that CPT.

So these above are 3 quick code snippets to hide or exclude categories in WordPress Admin Post Editor screen. While the first one hides them using CSS, the later is the WordPress approach doing the same. And the last one helps you removing the Category/Tag Meta Boxes.

Hope these snippets helped you hiding certain categories for the Post Editor. Do you have any other method to exclude WordPress categories from the admin screen? Do let us know in the comments. 

You Might Interested In


  1. Simone says:

    Hello, i tried the snippet Exclude Categories in the Add New/Edit Post Screen and put in functions.php of my theme.
    Instead of ‘slug-one’ i put the slug of the category i would like to exclude but the category is still showing when editing an existing post or adding new one.
    Im using latest WP 5.5 stable release.

  2. Jennie Kim says:

    hi amit
    it’s not working on gutenberg editor.
    it’s working for classic editor.
    hope for another updated snippet.
    thank you.

    1. Amit Sonkhiya says:

      Hello Morshed,

      I have the updated WordPress version 5.4.2 and the code snippet is working for me. I believe that you have missed placing the code correctly.


Leave a Reply

Enclose a code block like: <pre><code>Your Code Snippet</code></pre>.