From 819626ce83f6abc8c3d9aa83c62fbb0872c4b7e8 Mon Sep 17 00:00:00 2001
From: Andrew Ozz
Date: Mon, 18 Jun 2018 15:01:27 +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.
Fixes #44342.
git-svn-id: https://develop.svn.wordpress.org/trunk@43370 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/comment-template.php | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
index f7626f5389..649f29a10b 100644
--- a/src/wp-includes/comment-template.php
+++ b/src/wp-includes/comment-template.php
@@ -2262,7 +2262,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' => '',
@@ -2270,10 +2269,14 @@ function comment_form( $args = array(), $post_id = null ) {
'
',
'url' => '',
- 'cookies' => '',
);
+ 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' ), '*' );
/**