I know how to get the last or oldest post data using following code
$posts = get_posts(array(
'post_type' => 'post',
'order_by' => 'publish_date',
'order' => 'ASC'
));
And then I will get the date from the first array itself, but is there any quickest way to get that ?
id
FROM {$wpdb->posts} WHEREpost_type
= 'post' ANDpost_status
= 'publish' ORDER BYpost_date
ASC");