Title: get latest post id
Last modified: August 19, 2016

---

# get latest post id

 *  Resolved [marcelvb001](https://wordpress.org/support/users/marcelvb001/)
 * (@marcelvb001)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/get-latest-post-id/)
 * Hi,
 * For a widget i’m trying to find out how i can get the ID tag of the most newest
   post.
 * Now it’s like this: get_post($post->ID);
 * But i selects all the posts and i just want to have the newest post.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/get-latest-post-id/#post-1091567)
 * There might be a more elegant way of doing it but…
 *     ```
       <?php
       $last = wp_get_recent_posts( '1');
       $last_id = $last['0']['ID'];
       ?>
       ```
   
 *  Thread Starter [marcelvb001](https://wordpress.org/support/users/marcelvb001/)
 * (@marcelvb001)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/get-latest-post-id/#post-1091590)
 * Thanks it did just the thing !
 *  [shatterjack](https://wordpress.org/support/users/shatterjack/)
 * (@shatterjack)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/get-latest-post-id/#post-1091859)
 * esmi, is there a way to do this for each author and then sort the authors by 
   their latest post?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘get latest post id’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [shatterjack](https://wordpress.org/support/users/shatterjack/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/get-latest-post-id/#post-1091859)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
