Support » Fixing WordPress » Show category ID in posts

  • Hello,
    I need show the ID of the category in a post. I used to show it in this way:

    $postid=$post->ID;
    $categoriapost=$wpdb->get_var("SELECT category_id FROM wp_post2cat WHERE post_id=$postid");

    But it doesn’t work in the last verion of WP, how can I show it?
    Thanks in advanced!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show category ID in posts’ is closed to new replies.