Answers for "wordpress get category by post id"

PHP
0

how to get category from post id

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

wordpress get post by id

$post   = get_post( 123 ); // Where 123 is the ID
$output =  apply_filters( 'the_content', $post->post_content );
Posted by: Guest on October-13-2020
0

wordpress display post categories

<?php the_terms( $post->ID, 'topics', 'Topics: ', ', ', ' ' ); ?>
Posted by: Guest on November-27-2020
-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 by post id"

Browse Popular Code Answers by Language