DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

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.


  1. 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');

    • web-developer is a cock

      Cock… No one said anything about PHP code… Should site owners be expected to go in to the code and write PHP? Idiot…

      And your code is BS anyway… Try:

  2. 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!

  3. 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!

  4. How to get the Category ID numbers of single post?

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

  6. 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.


  7. Ah! Finally. Simple workaround. Thanks so much!

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

  9. 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…

  10. @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… 😉

  11. 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);

  12. Thanks… just what I needed!

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

  14. Thanks so much!

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

    @wprecipes – TY!

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

  17. I need help with this code

    ID, ‘item_image’, true); ?>

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

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

    Show only first category id

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

  19. 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

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

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

  22. Don’t listen to the negative comments!

    This post Saved My Life!

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

  24. 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.

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

  26. great!!! thanx a lot :)

  27. Mariusz - trojmiasto.us

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

  28. Hey,

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

    Thanks for the input.

    Nuff said!

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

  31. It´s so simple when you know it! Thanks

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

  33. 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

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

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

  36. Thanks for web-developer, works fine with global $wp_query…

  37. Thanks, this did the trick in a simple way and even the comments had some good php codes.

  38. Unfortunately the title of this post is a let down. It gives one option of how to find the Category ID in wordpress, it should also give the option as previously mentioned by other posts:
    global $wp_query;
    $cat_ID = get_query_var(‘cat’);

    Which is exactly what I wanted!

  39. Its shows all the categories id with name ..,,

    $category_ids = get_all_category_ids();
    foreach($category_ids as $cat_id) {
    $cat_name = get_cat_name($cat_id);
    echo “”; echo $cat_id . ‘: ‘ . $cat_name;
    echo “”;

  40. global $wp_query;
    $cat_id = get_query_var('cat')?get_query_var('cat'):$_GET["tag_ID"];

Leave a Comment

Your email address will not be published. Required fields are marked *