'I need to get the post id for the first post of the current user in wordpress
I have this so far
get_currentuserinfo(); $the_post = get_posts("author=" . $current_user->ID . "&posts_per_page=1"); $the_post = $the_post[0];
but I'm not sure how to get just the ID out of the array
Solution 1:[1]
You can write query like this way-
$oldest_post_query = get_posts("post_type=post&numberposts=1&order=ASC");
$oldest_post_id = $oldest_post_query[0]->ID;
//print the post title
<h1><a href="'.get_permalink( $oldest_post_id ).'" rel="next">'.get_the_title( $oldest_post_id ).'</a></h1>';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tanvir |
