Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Going through the comments table on my wordpress site, I noticed that wordpress is storing the ip address of everyone who makes a comment on my site. How do I remove this functionality?

I'm not just talking about the display of the ip in the template, I mean I don't want wordpress to capture it in the first place.

share|improve this question
    
As a plugin: T5 No Comment IP. –  toscho Apr 30 '13 at 15:30
add comment

1 Answer

up vote 4 down vote accepted

Add this to your functions.php:

add_filter('pre_comment_user_ip', 'no_ips');
function no_ips($comment_author_ip){
  return '';
}

You'll still have the comment_author_IP field in the db, but it will be empty...

And to remove existing IP records from the db run this query:

UPDATE `wp_comments` SET `comment_author_IP` = ''
share|improve this answer
    
thank you very much! That was a very nice little hidden gem of a function. –  shawn Jun 22 '11 at 10:05
3  
You could just set __return_zero() as filter function. No need to create a new one. :) –  toscho Jun 1 '12 at 9:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.