Prevent future posts from publishing early. fixes #7441

git-svn-id: http://svn.automattic.com/wordpress/trunk@9123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-10-11 05:46:20 +00:00
parent 6d0d781ad6
commit 2dcef9570d
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);
} }