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
This commit is contained in:
Scott Taylor 2015-10-31 20:13:24 +00:00
parent a36900c076
commit 244cb3e595
2 changed files with 6 additions and 1 deletions

View File

@ -2592,6 +2592,11 @@ function _close_comments_for_old_post( $open, $post_id ) {
if ( ! in_array( $post->post_type, $post_types ) ) if ( ! in_array( $post->post_type, $post_types ) )
return $open; 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 ) ) if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) )
return false; return false;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.