Remove Or Edit Save My Name Email And Website In This Browser For The Next Time I Comment

When someone try to comment on your WordPress website while they are not logged in. They will see a checkbox in their comment form with label “save my name email and website in this browser for the next time i comment”. There are several reasons you might want to change it to some simple words, or in your own language. Or you want to say some cool stuff with checkbox to save cookie. In our case we want to say Remember me.

Just add the code below make sure you change Remember me! to anything you want to edit or replace label to.

add_filter( 'comment_form_default_fields', 'wc_comment_form_change_cookies' );
function wc_comment_form_change_cookies( $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">'.__('Remember Me!', 'textdomain').'</label></p>';
	return $fields;
}

Leave a Reply

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