I have a code.
add_action( 'init', 'njengah_change_post_date_programmatically');
function njengah_change_post_date_programmatically(){
$time = current_time('mysql');
wp_update_post(
array (
'ID' => 838, // ID of the post to update
'post_date' => $time,
'post_date_gmt' => get_gmt_from_date( $time )
)
);
}
But this code only work on function php.
The idea is, I want retrieve the ID from post meta in my current post. The post date will retrieve from current post. And the post is the latest post.