WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This might be very basic question, but I can't really get the category ID on category page (actually a category page of custom type post).

Filename is taxonomy-item-category.php & URL is http://www.abc.com/cat/food/

I have tried some of the following but not working...

$cur_cat_id = get_cat_id( single_cat_title( "food", false ) );
$cur_cat_id = get_cat_id( single_cat_title( "", false ) );

get_the_category( "food" );

How can I get the category ID on category page?

share|improve this question
up vote 3 down vote accepted

$cat_id = get_queried_object_id(); - it's that simple!

share|improve this answer
Thanks so much. It's simple but It wasn't so easy for newbie. Thanks again. – pulla Jun 24 '13 at 9:08

Maybe this is more easy way to find ID

Find Category Id in Wordpress

share|improve this answer
Answers should be more than outgoing links. Please answer the question in here. If the link was of help or you've taken something from there, use it for quotes or as reference. – kaiser Sep 29 '13 at 5:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.