wordpress snippets last updated   : August 18, 2014
we now have 638 snippets

Get post ID outside of loop

wordpress snippet

Adding this PHP code snippet to your single.php will return the current post ID.

snippet :  PHPcopy
       global $wp_query;
       $postID = $wp_query->post->ID;

Did you like this post? If so please share it with your friends. Thanks!

jqsnipp.com | we just launched jquery snippets website