How to: find WordPress category ID

Some themes requires that you fill a form field with a category ID. It may be easy to find a category ID if you’re an advanced WordPres user, but what about beginners? Here’s a very simple manner to find any category ID.

Once you're logged in your WordPress dashboard, go to Manage and then in Categories.
Simply put your mouse cursor on the "edit" link related to the category you want to know the ID and look on your browser's status bar: As you can see on the screenshot below, 1 is the id of the category.

35 Responses

Jul 15 2011 15:19

Not interesting post, because it should be about “how to find category id in php” and not “how to find category id on your screen”. :)
The correct answer is:

global $wp_query;
$cat_ID = get_query_var('cat');

Jul 29 2011 23:44

No “web-developer” this post is exactly right, its about wordpress and an easy way to find a category ID, which was exactly what I needed. Not some string I have no idea where to place. Thanks anyway!

Jul 31 2011 09:27

Contrary to the cat with a melon on his head, I actually did find it useful… I always use slugs to navigate my wordpress site so when I had a theme asking for a category id I was stumped! thanks!

Aug 02 2011 18:25

How to get the Category ID numbers of single post?

Aug 03 2011 00:09

Thanks!!! this is what I was looking for. no haters!!!

Aug 08 2011 00:43

WP 3.2.1 doesn’t show cat_id in the url anymore. Follow the instructions above and look for tag_ID. Even though it says tag_id in the url, it is actually your category ID. Using the tag_id as my category ID just worked successfully in a query_posts.

-Steve

Aug 16 2011 05:35

Ah! Finally. Simple workaround. Thanks so much!

Aug 29 2011 08:04

Thanks! This post and Steve’s comment regarding 3.2.1 assisted me! You rock!

Sep 05 2011 00:25

Thanks to Author and Steve…
But still i wonder why the morons cant just display it along with the name, slug, etc. More prominently i mean.
sometimes, WP rocks… sometimes, it sucks!
Thanks again guys…

Sep 07 2011 18:53

@web-developer thank you for that code! Placing it in my theme’s category.php file helps me customize certain categories, especially since WP doesn’t allow “heavy-duty” HTML in the descriptions.

And thanks too @steve and @wprecipes. Sometimes the “simple” stuff is the easiest to overlook… ;)

Sep 26 2011 11:08

Heya, thank you for sharing. I already knew the trick written by Steve and WPrecipes… but the comment from web-developer helped me very well!

Now I can use in my createCat function the simple array to get all the posts with the easy stuff! Yus, I am getting rid of the silly loop ;)

global $wp_query;
$cat_ID = get_query_var(‘cat’);
$args = array(‘category’ => $cat_ID);
$posts_array = get_posts($args);

Nov 05 2011 21:54

Thanks… just what I needed!

Dec 03 2011 03:57

This was very helpful, so thank you! Also, your kitty graphics are adorable. :)

Jan 12 2012 06:31

Thanks so much!

Jan 26 2012 19:21

@webdev – to me this is the most interesting post of the day… helped me find the blog id in a wpmu.

@wprecipes – TY!

Feb 12 2012 04:08

So where would i put that code? I’m in the new wp and can’t find the id at all! REally stumped. Thanks!

Feb 15 2012 05:19

I need help with this code

ID, ‘item_image’, true); ?>

How can I change the cat=11 to tag_id???

Apr 23 2012 14:11

foreach((get_the_category()) as $cat) {
echo $category->cat_ID. ”;
}

Show only first category id

$category = get_the_category();
echo $category[0]->cat_ID;
?>

May 16 2012 09:30

thank you so much for that, got me right out of a hole and very simply too. BTW, after I got over the shock of @web-developer’s first comment, I started to think he was offering something extra but I still don’t know how he uses the code he gave

Jun 16 2012 15:07

Thank you for this. I wanted to know the category for related posts plugins, thank you.

Jun 16 2012 18:21

Thank you so much, this was exactly what I needed. =)

Jul 30 2012 22:37

Don’t listen to the negative comments!

This post Saved My Life!

Aug 19 2012 00:38

There is another way. You can just go to your database, to table wp_terms and from there I think it’s pretty obvious.

Sep 06 2012 17:52

When I was hovering over my category name the ID would not appear in status bar. I later discovered that it was loading slower so I had to wait for it to appear. Anyways, good help from you indeed. Thanks again.

Sep 24 2012 18:21

I saw many people just criticizing on that post. But author has mentioned it is for beginner. Great trick for beginners I would say.

Dec 12 2012 06:02

great!!! thanx a lot :)

Jan 03 2013 12:51

Fine, but how to display post’s current and parent category ID?

Feb 16 2013 10:48

Hey,

This one had got me struck for more than 2 hours.
Your note solved it in a giffy.

Thanks for the input.

Feb 23 2013 17:22

THANK YOU. THANK YOU. THANK YOU.
Nuff said!

Mar 04 2013 05:18

There’s a free plugin called Reveal IDs. Try it!

Mar 25 2013 18:44

It´s so simple when you know it! Thanks

Mar 30 2013 06:48

Very helpful! And thank you for making the post short and to the point. I found what I needed, and fast. Much appreciated!

Apr 28 2013 17:55

Thanks for the post it helped me find the ID. With the version of WP they are on over at wordpress.com you need to hover over the “delete” by category and then pull the ID out of the string at the bottom of the page. Would be great if they just put this in the category ID info page

May 05 2013 16:04

Thank you very much, just needet a simple way to find out the cat number. It works!

May 23 2013 03:13

Thank you! very useful post. Before finding this article I don’t know how to find category id.

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required

WP Theme of the week

Sponsored Likebox