Check if current page is category page in wordpress?

you can use this for getting category

is_category();
is_category( '1' ); // where 1 is category id
is_category( 'test' ); // where test is category name
is_category( 'test-ing' ); // where test-ing is category slug

You can use

is_category();

function.

refrence: http://codex.wordpress.org/Function_Reference/is_category


I have found the way to do it by checking if $cat_id is available or not on that page by the following.

$cat_id = get_query_var('cat');

Now we can check if $cat_id is available then it is a category page otherwise it is not.

Tags:

Php

Wordpress