Get Category Post ID

This will help get and display the 1st category ID of the current post

 

$categories = get_the_category(); //get all categories for this post
echo ‘first category is ‘ . $categories[0]->cat_ID;

Leave a Reply