From 9ad59101abba378813bed4bcc82e8da0811a89bf Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 16 Jul 2018 12:07:25 +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. Built from https://develop.svn.wordpress.org/branches/4.9@43449 git-svn-id: http://core.svn.wordpress.org/branches/4.9@43276 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 11 +++++++---- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 7bde60c517..f24c68025b 100644 --- a/wp-includes/comment-template.php +++ b/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. diff --git a/wp-includes/version.php b/wp-includes/version.php index 4fb03b6d96..ff0bd58197 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.8-alpha-43448'; +$wp_version = '4.9.8-alpha-43449'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.