Stop Saving Commenter Details in Cookies
Stops WordPress from remembering commenters' name, email and website in cookies, and removes the related consent checkbox.
Opens WPIDE on
Code
add_action( 'init', function () {
remove_action( 'set_comment_cookies', 'wp_set_comment_cookies' );
} );
add_filter( 'comment_form_default_fields', function ( $fields ) {
unset( $fields['cookies'] );
return $fields;
} );
Notes
Returning visitors have to type their details again; pending comments are no longer shown to their author.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.