Get current category ID of WordPress page

The current category ID is in the global $cat variable, when you are in a category page you can get it as follows.

 
<?php
    if (is_category()) {
		$category = get_category(get_query_var('cat'));
		$cat_id = $category->cat_ID;
	}
?>

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …


Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us