From 92ad9c0a3ea0e5a4c5108304e06bf3ebf6adc155 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 16 Jul 2018 12:06:02 +0000 Subject: [PATCH] Privacy: do not show the comment cookies opt-in checkbox (on the front-end comments form) when comment cookies are disabled. Props felipeelia, johnbillion. Merges [43370] to the 4.9 branch. Fixes #44342. git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43449 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment-template.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php index 7bde60c517..f24c68025b 100644 --- a/src/wp-includes/comment-template.php +++ b/src/wp-includes/comment-template.php @@ -2196,7 +2196,6 @@ function comment_form( $args = array(), $post_id = null ) { $req = get_option( 'require_name_email' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = 'html5' === $args['format']; - $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; $fields = array( 'author' => '

' . ' ' . '

', @@ -2204,11 +2203,15 @@ function comment_form( $args = array(), $post_id = null ) { '

', 'url' => '

' . '

', - 'cookies' => '', ); - $required_text = sprintf( ' ' . __('Required fields are marked %s'), '*' ); + if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) ) { + $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; + $fields['cookies'] = ''; + } + + $required_text = sprintf( ' ' . __( 'Required fields are marked %s' ), '*' ); /** * Filters the default comment form fields.