How to Find a Category ID in WordPress (and Hide It)?

While trying to hide a category on my WordPress site, I looked into different methods and ended up summarizing these two approaches. Each one works well, so choose whichever is more convenient for you.


Check the Category Edit Page (Simple Method)

1. Go to Categories: In your WordPress dashboard, click Posts > Categories.

2. Edit the Category: Find the category you want to hide, hover over it, and click Edit.

3. Look at the URL: In your browser’s address bar, find a parameter like tag_ID=50. The number after tag_ID= is your category ID.

This is usually the quickest way. If the ID doesn’t show in the URL, or if you prefer a more technical route, you can try the next method.


Query the Database (Advanced Method)

1. Access MySQL: Log in to your server using SSH, then open the MySQL shell.

USE your_database_name;

2. Look in wp_terms: Search for the category by name:

SELECT * FROM wp_terms WHERE name = 'CyberSecurity';

For instance, if you see a row with term_id = 50, then 50 is your category ID.

3. Confirm the Taxonomy (optional): In rare cases, the same term_id can be used for different taxonomies (like tags or custom taxonomies). Check wp_term_taxonomy to make sure the taxonomy is category:

SELECT * FROM wp_term_taxonomy WHERE term_id = 50;


Hiding the Category

After you have the ID, look for a setting in your theme or plugin that says something like “Exclude Categories.” Enter the ID (or multiple IDs separated by commas). For example:

Exclude Categories: 50, 12, 23

Once saved, the category (or categories) you listed should no longer appear in the areas controlled by that setting.