Remove the check box “Save my name, email…” from comment area

This checkbox was added in WP 4.9.6 and makes it so your comment forms are compatible with GDPR, which comes into effect on May 25th.

I definitely suggest you read up on it, as there are some pretty heavy fines if the rules aren’t followed.

If your site isn’t affected by GDPR, then you can removable adding this in to your theme's functions.php file....  this is not recommend becouse doing this for a theme that could update can lose the code, so it is better to make a plugin.   See - How to Make a plugin

Add the following PHP ....

add_filter( 'comment_form_default_fields', 'tu_comment_form_hide_cookies_consent' );
function tu_comment_form_hide_cookies_consent( $fields ) {
unset( $fields['cookies'] );
return $fields;
}

If you don’t want to remove the checkbox but instead edited it use...

add_filter( 'comment_form_default_fields', 'tu_comment_form_change_cookies_consent' );
function tu_comment_form_change_cookies_consent( $fields ) {
$commenter = wp_get_current_commenter();

$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">Your modified text here</label></p>';
return $fields;
}

Leave a Comment

Your email address will not be published. Required fields are marked *