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?

2 Answers 2


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

  • 1
    Thanks so much. It's simple but It wasn't so easy for newbie. Thanks again.
    – pulla
    Commented Jun 24, 2013 at 9:08

Maybe this is more easy way to find ID

Find Category Id in Wordpress

  • 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
    Commented Sep 29, 2013 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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