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.
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.
Inside the loop:
<?php $wp_query->post->ID; ?>
Outside the loop:
<?php $post_id = $wp_query->post->ID; echo $post_id;?>
This topic has been closed to new replies.