What function can be used to update a post's post date and time to the current date & time?


Call wp_update_post() with a special value for 'post_date' and 'post_date_gmt':

$time = current_time('mysql');

    array (
        'ID'            => 123, // ID of the post to update
        'post_date'     => $time,
        'post_date_gmt' => get_gmt_from_date( $time )
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.