Prevent future posts from publishing early. fixes #7441

git-svn-id: https://develop.svn.wordpress.org/trunk@9123 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2008-10-11 05:46:20 +00:00
parent 36508586aa
commit 46740aae3a
1 changed files with 8 additions and 0 deletions

View File

@ -1622,6 +1622,14 @@ function check_and_publish_future_post($post_id) {
if ( 'future' != $post->post_status ) if ( 'future' != $post->post_status )
return; return;
$time = strtotime( $post->post_date_gmt . ' GMT' );
if ( $time > time() ) { // Uh oh, someone jumped the gun!
wp_clear_scheduled_hook( 'publish_future_post', $post_id ); // clear anything else in the system
wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) );
return;
}
return wp_publish_post($post_id); return wp_publish_post($post_id);
} }