• Hi!,
    I’m at the final phase of developing a plugin but I have a problem: I can’t get the id of the current post. And I couldn’t found any functions to get the id OUTSIDE the loop (get_the_ID doesn’t work in this case). Any suggestions?. Thanks.

Viewing 1 replies (of 1 total)
  • Inside the loop:

    <?php $wp_query->post->ID; ?>

    Outside the loop:

    <?php $post_id = $wp_query->post->ID; echo $post_id;?>

Viewing 1 replies (of 1 total)
  • The topic ‘Get the id’ is closed to new replies.