title: Wordpress - How to get the next new post ID
body: <p>I need to get the next new post ID in a product page.</p>
  
  <p>So I know how to get last post id in DB, but I need to know second new post ID.</p>
  
  <pre><code>function GetLastPostId()
  {
      global $wpdb;
  
      $query = "SELECT ID FROM $wpdb-&gt;posts ORDER BY ID DESC LIMIT 0,1";
  
      $result = $wpdb-&gt;get_results($query);
      $row = $result[0];
      $id = $row-&gt;ID;
  
      return $id;
  }
  </code></pre>
  
  <p>The problem is, for example, know the last post id is 1510, but then I create product - post id becaume 1513 not 1511 (added 3 not 1). Then I Delete some pages/products it adds 2 not 3 or sometimes 1</p>
  
  <p>So is it possible to get next post id some how?</p>
  
  <p>Thanks</p>