From ad68a69250e41b4468c12f6ad1eb2e122e94159b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 20 Jul 2018 00:38:24 +0000 Subject: [PATCH] Comments: Ensure that themes overriding default `comment_form()` fields still display the cookies consent checkbox. The `comment_form_default_fields` filter can be used to remove the checkbox. Props pross, SergeyBiryukov. Fixes #44126. Built from https://develop.svn.wordpress.org/trunk@43518 git-svn-id: http://core.svn.wordpress.org/trunk@43347 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 986639af13..1f7596dc55 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -2275,6 +2275,11 @@ function comment_form( $args = array(), $post_id = null ) { $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; $fields['cookies'] = ''; + + // Ensure that the passed fields include cookies consent. + if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) { + $args['fields']['cookies'] = $fields['cookies']; + } } $required_text = sprintf( ' ' . __( 'Required fields are marked %s' ), '*' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 63a0739c1b..0976092127 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-43517'; +$wp_version = '5.0-alpha-43518'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.