Get the latest Post ID in WordPress

Published: 29, Oct 2014
PHPWordPress

Here’s a neat little trick that will get you the latest post ID from WordPress.

<?php 
echo $newest_post_id = $posts[0]->ID;
?>