How do I turn off wordpress comments ability to capture a users ip address?

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.

Related posts

Leave a Reply

1 comment

  1. 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` = ''