• I’ve searched for an answer to my question for about 6 hours now but can’t find a solution that works. As a last resort I’m posting here so I apologize if this has been answered.

    I’m trying to pull the post ID within the footer. Sounds easy enough, right? In the past (prior to wp 3), I’ve used this code:

    global $wp_query;
    $post_id = $wp_query->post->ID;

    Since using WordPress 3, this code no longer returns anything. Has anyone had a similar experience or possible alternate solution? I appreciate the help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try:

    global $post;
    $post_id = $post->ID;

    Thread Starter Humble Bazooka

    (@otakonx)

    Thanks, jooniya, for the fast reply. Unfortunately, no dice. That didn’t work either. But I just reinstalled wordpress and everything is now working except the news categories, which I think is normal. So it looks like I had a bad run of upgrades. I wish I knew what was broken though. Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom query does not work in footer – trying to get Post ID’ is closed to new replies.