# Stop Saving Commenter Details in Cookies

> Stops WordPress from remembering commenters' name, email and website in cookies, and removes the related consent checkbox.

- Type: PHP
- Runs: Run everywhere
- Category: [Comments](https://wpide.com/library/category/comments/)
- Tags: comments, cookies, privacy
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/disable-comment-cookies/

## Code

```php
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 use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Stop Saving Commenter Details in Cookies" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
