Remove Website Field From WordPress Comment & Change Cookies Remember Text | Code For Developers

Remove Website field from WordPress comment & Change cookies remember text

Remove Website field from WordPress comment & Change cookies remember text to Remember me!

If you have comment active on your WordPress site but you dont want to keep website field then this might help you.

There is some plugin to do it but we are going to show with simple custom code as always.

Put this code on you theme functions.php file and you will see website field gone.

add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
       return $fields;

Now comment from might look like this. Look on remembering user text show “save my name, email, and website” it funny as you did not have any website field.

July 7, 2020
WordPress comment from without website

So, now let change this text to just simple Remember Me! and here is your code

add_filter( 'comment_form_default_fields', 'mukto_comment_save_text' );
function mukto_comment_save_text( $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;

if you want to remove that checkbox completely this can help

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

That’s all, Read our Cookie Popup with jQuery tutorial to accpet cookies permission

Previous Code

Easy ACF repeater Bootstrap accordion in WordPress

FAQ collapse design with ACF repeater Bootstrap ac ...

Next Code

Add Classe when the item visible

Add class on scroll to viewport jquery code ...

Leave a Reply

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


If you find it useful

Buy me a coffee









WordPress Ajax Search without plugin [ Easy ]

WordPress Ajax Search without plugin. Fully custom ...

Conditional statement to show pagination

Conditional statement to show pagination on WordPr ...

HTML img tag to HTML SVG tag [WordPress]

Image to SVG for WordPress. Generate svg code from ...

wp-config development code

WordPress post revisions, debug, load-scripts.php ...

WordPress .htaccess code for redirect www to non www url

Remove www from url or redirect ...