WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 5 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
You could just set __return_zero() as filter function. No need to create a new one. :) – toscho Jun 1 '12 at 9:34

Your Answer


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.