From 2dcef9570de82d7348c3375638dffe9e3f618e1e Mon Sep 17 00:00:00 2001 From: markjaquith Date: Sat, 11 Oct 2008 05:46:20 +0000 Subject: [PATCH] Prevent future posts from publishing early. fixes #7441 git-svn-id: http://svn.automattic.com/wordpress/trunk@9123 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-includes/post.php b/wp-includes/post.php index fc328279ac..804abe6aca 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1622,6 +1622,14 @@ function check_and_publish_future_post($post_id) { if ( 'future' != $post->post_status ) 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); }