最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Disable saving comment details (name, e-mail) in cookie?

programmeradmin0浏览0评论

The European Union has introduced a directive requiring that websites obtain permission for setting all 'non-essential' cookies. In the UK (where my site is based), the appropriate detail is explained by the ICO.

As I understand it, with a 'vanilla' WordPress site the only cookies set are:

  1. Those for logged in users to allow administration, etc.
  2. One to store the name and e-mail address of people leaving comments.

The first of these seems to fall under the 'strictly necessary' clause, and my site is set up so that general log in is not an option anyway: it's only for administration. However, the second form of cookie seems to me to fall within the scope of requiring consent.

There are lots of plugins about to add banners, etc. asking for permission, but as this functionality is not really needed I'd rather just turn off saving the cookie entirely, while still allowing comments to be left. That seems to be a lot more difficult to find out about. So I'm looking either for a plugin or direct modification of the code to do this.

The European Union has introduced a directive requiring that websites obtain permission for setting all 'non-essential' cookies. In the UK (where my site is based), the appropriate detail is explained by the ICO.

As I understand it, with a 'vanilla' WordPress site the only cookies set are:

  1. Those for logged in users to allow administration, etc.
  2. One to store the name and e-mail address of people leaving comments.

The first of these seems to fall under the 'strictly necessary' clause, and my site is set up so that general log in is not an option anyway: it's only for administration. However, the second form of cookie seems to me to fall within the scope of requiring consent.

There are lots of plugins about to add banners, etc. asking for permission, but as this functionality is not really needed I'd rather just turn off saving the cookie entirely, while still allowing comments to be left. That seems to be a lot more difficult to find out about. So I'm looking either for a plugin or direct modification of the code to do this.

Share Improve this question asked Jun 26, 2012 at 18:06 Joseph WrightJoseph Wright 1635 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 4

That is actually dead simple. Cookies are set by wp_set_comment_cookies() and this function is hooked into 'set_comment_cookies'. Just remove the function from the action:

<?php # -*- coding: utf-8 -*-
/* Plugin Name: No Comment Cookies
 */
remove_action( 'set_comment_cookies', 'wp_set_comment_cookies' );

Download on GitHub.

发布评论

评论列表(0)

  1. 暂无评论