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.
Merges [43518] to the 4.9 branch.
Fixes #44126.
Built from https://develop.svn.wordpress.org/branches/4.9@43524


git-svn-id: http://core.svn.wordpress.org/branches/4.9@43353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-07-24 12:43:28 +00:00
parent b20bfba009
commit 92096f4c64
2 changed files with 6 additions and 1 deletions

View File

@ -2209,6 +2209,11 @@ function comment_form( $args = array(), $post_id = null ) {
$consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
$fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
'<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>';
// 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' ), '<span class="required">*</span>' );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9.8-beta2-43523';
$wp_version = '4.9.8-beta2-43524';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.