Answers for "wordpress get category id of post"

PHP
0

how to get category from post id

get_the_category($post->ID)
Posted by: Guest on January-04-2021
3

wordpress get post id

// Retrieve the ID of the current item in the WordPress Loop.
get_the_ID()
Posted by: Guest on February-19-2021
-2

wp get category by id

<?php
$category_id = 21; //use your own category id
$category = get_category( $category_id );
echo $category->name;
echo $category->cat_ID;
//print_r($category);
//to get all the properties of the $category
?>
Posted by: Guest on July-24-2021

Code answers related to "wordpress get category id of post"

Browse Popular Code Answers by Language