WordPress tutorials: Get post ID

Wpsnipp – The ID of the post you’d like to fetch. You must pass a variable containing an integer. A literal integer will cause a fatal error (Only variables can be passed for reference or Cannot pass parameter 1 by reference). Adding this PHP code to your wordpress theme will display the current post ID.

 

 

<?php
the_ID();
?>

Leave a comment