Skip to content

[BUG] Unable to remove the cookie checkbox #921

@KatyPurry

Description

@KatyPurry

Describe the bug

Hello,

I'm only on version 5.2.0.0 with a child theme on Wordpress 6.7.1 (up to date). It seems that the parent theme overrides the setting in admin section to "Save my name, email, and website in this browser for the next time I comment". In the admin, whether I check or uncheck the option, it always appears.

In the parent theme, I found the comment-list.php file :

// Comment Cookie Checkbox
function wp44138_change_comment_form_cookies_consent($fields) {
  $consent  = empty($commenter['comment_author_email']) ? '' : ' checked="checked"';
  $fields['cookies'] = '<p class="comment-form-cookies-consent custom-control form-check mb-3">' .
    '<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" class="form-check-input"' . $consent . ' />' .
    '<label for="wp-comment-cookies-consent" class="form-check-label">' . __('Save my name, email, and website in this browser for the next time I comment.', 'bootscore') . '</label>' .
    '</p>';
  return $fields;
}
add_filter('comment_form_default_fields', 'wp44138_change_comment_form_cookies_consent');
// Comment Cookie Checkbox End

In my child theme, I tried removing the filter :

remove_filter('comment_form_default_fields', 'wp44138_change_comment_form_cookies_consent');

But it doesn't seem to be having any effect. It only works if I delete this block in the parent theme (which I want to avoid).

I know my theme isn't up to date, but I've made quite a lot changes to my child theme and unfortunately I don't have the time at the moment to look at all the changes that could break my website, which is scheduled for 2025!

Thanks a lot !

Steps to reproduce

No response

Screenshots and Additional Info

No response

Website link

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions