Created
February 26, 2021 19:42
-
-
Save Garconis/7d00d65f746dace1fd714cd0e16def6c to your computer and use it in GitHub Desktop.
WordPress | Always set Published Post Date to today (NOW) for certain Post ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// get current time | |
$time = current_time('mysql'); | |
// set the post ID to have a post date of NOW | |
wp_update_post( | |
array ( | |
'ID' => 3274, // ID of the post to update | |
'post_date' => $time, | |
'post_date_gmt' => get_gmt_from_date( $time ) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment