diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index a5ebcd1668..d9394cbc2d 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -813,7 +813,7 @@ function wp_comment_form_unfiltered_html_nonce() { function comments_template( $file = '/comments.php', $separate_comments = false ) { global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage; - if ( ! (is_single() || is_page() || $withcomments) ) + if ( !(is_single() || is_page() || $withcomments) || empty($post) ) return; if ( empty($file) )