From 61ff693ff0124265432500abce40bf0d62ec176d Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Mon, 28 Dec 2015 22:57:37 +0000 Subject: [PATCH] Comments: Return early from `wp_update_comment_count()` if there is not a valid post. Props ambrosey, juanfra. Fixes #34977 git-svn-id: https://develop.svn.wordpress.org/trunk@36115 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index a84f0a70b9..7dafa1eaef 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -2010,6 +2010,10 @@ function wp_defer_comment_counting($defer=null) { function wp_update_comment_count($post_id, $do_deferred=false) { static $_deferred = array(); + if ( empty( $post_id ) && ! $do_deferred ) { + return false; + } + if ( $do_deferred ) { $_deferred = array_unique($_deferred); foreach ( $_deferred as $i => $_post_id ) {