How to get Category Id from Post Id ?

I need to get any post category id from the post id(Not for current) Post.
How can i ?

Thanks

2 Answers
2

You can try this code for getting category id from post id:

global $post;
$category_detail=get_the_category( $post->ID );

Leave a Comment