I need to get any post category id from the post id(Not for current) Post. How can i ?
Thanks
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou can try this code for getting category id from post id:
global $post;
$category_detail=get_the_category( $post->ID );
Take a look at wp_get_post_categories function. It returns an array of categories' ID for specific post.
$post_categories = wp_get_post_categories( $post_id );