From 46740aae3aa522f0a23a0a77d322f50c7b9309d6 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Sat, 11 Oct 2008 05:46:20 +0000 Subject: [PATCH] Prevent future posts from publishing early. fixes #7441 git-svn-id: https://develop.svn.wordpress.org/trunk@9123 602fd350-edb4-49c9-b593-d223f7449a82 --- 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); }