From 244cb3e5959f61693afc6a6128fd948d1024105c Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 31 Oct 2015 20:13:24 +0000 Subject: [PATCH] Comments: don't auto-close comments on draft posts. Adds unit tests. Props solarissmoke, MikeHansenMe, nacin, rachelbaker. Fixes #20262. Built from https://develop.svn.wordpress.org/trunk@35475 git-svn-id: http://core.svn.wordpress.org/trunk@35439 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index e1975f62e6..ae40a8a7f9 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -2592,6 +2592,11 @@ function _close_comments_for_old_post( $open, $post_id ) { if ( ! in_array( $post->post_type, $post_types ) ) return $open; + // Undated drafts should not show up as comments closed. + if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { + return $open; + } + if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) return false; diff --git a/wp-includes/version.php b/wp-includes/version.php index d90bcc21df..b7ec0f3227 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-beta2-35474'; +$wp_version = '4.4-beta2-35475'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.