Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Garconis/7d00d65f746dace1fd714cd0e16def6c to your computer and use it in GitHub Desktop.
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
<?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