Skip to Main Content

How to stop storing WordPress comments IP addresses

Divi: the easiest WordPress theme to use

Divi: The best WordPress theme of all time!

With over 901.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]

After reading our article on how allow anonymous comments, one of our readers asked us if it was possible to stop storing IP addresses on WordPress comments. Some website owners may want to do this to protect the privacy of their users.

In this tutorial, we will show you how to stop storing IP addresses on WordPress comments.

But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

privacy in WordPress comments

Advantages and disadvantages of the operation

By default, WordPress logs the IP addresses of users who leave comments on your website. These IP addresses are permanently stored in your database.

The reason for this storage of IP addresses is mainly to fight against spam comments. Plugins like Akismet can block comments from known IP addresses commonly used by spammers.

Unless your users are using a VPN service, their real IP addresses can still be found in your website logs. Most WordPress hosting has a log where all visitors are listed for a set amount of time.

On the other hand by not storing the IP address in WordPress comments, you can improve the confidentiality of stakeholders on your website. They may feel more confident in expressing their opinions knowing that your website does not store IP addresses with their comments.

1 Method: Stop Storing Comments with a Plugin

This method is easier and recommended for beginners.

The first thing you need to do is install and activate the " Remove IP ". For more details, check out our step by step guide on how to install a WordPress plugin.

Once activated, the plugin will replace the IP address of the users by, which is an IP address generally used by localhost (local).

The plugin will not delete stored IP addresses from older comments. If you have older comments with IP addresses, it is also possible to delete them. We will show you how to get there a little further down in this tutorial.

2 Method: Stop IP Address Storage Manually

If you are comfortable pasting php snippets into WordPress plugins / themes on WordPress, then you can use this method.

Easily create your website with Elementor

Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]

All you have to do is code the following code In your WordPress plugin.

Function bpc_hide_ip ($ comment_author_ip) {return ''; } Add_filter ('pre_comment_user_ip', 'bpc_hide_ip');

It's basically the same code used by the plugin that we mentioned in the first method. However, instead of storing, it leaves the field empty. You can change the return value of the function « bpc_hide_ip And add the IP address of your choice.

How to remove the IP address from old comments

Regardless of the method used to stop storing IP comments, old comments on your website will always have the original IP addresses.

If you have old comments on your website, you can remove the IP addresses from those comments.

We will show you how to do this by running a MySQL query on your WordPress database. It's really important to make sure you have the most recent backup of your blog's database.

Then you need to log into your cPanel and search phpMyAdmin.

Make sure you have selected the database of your WordPress blog by clicking on the name of the database in the column on the left. After that, you have to click on the SQL menu.

WordPress code execution MySQL

You will find a text box or insert the MySQL code

UPDATE 'wp_comments' SET 'comment_author_IP' = '';

Click the " Go Below the text box to execute your query. That's it, it will delete all the IP addresses stored in old comments.

You must pay attention to the prefix of your installation. In the previous code, we used " wp_ ”, But it may be different. That's all there was to do. If you have any questions, please do not hesitate to comment on the article.

Are you looking for the best WordPress themes and plugins?

Download the best plugins and WordPress themes on Envato and easily create your website. Already more than 49.720.000 downloads. [EXCLUSIVE]

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern look and optimize the grip of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. Disqus Comment System

This is the system of comments that every WordPress website should have.

Disqus comment system wordpress plugin

It works like a consultation network, which means that comments that are saved on your website are also saved on the Disqus community, which helps people discover content that may interest them.

Download | Demo | Web hosting

2. Media Grid

Media Grid is a unique premium WordPress plugin that makes it easy to create unlimited responsive, filterable and paginated portfolios, taking advantage of the script Masonry. Using its advanced techniques allows you to create your own layouts and adapt them to any container. In addition, Media Grid is optimized and compatible with multiple mobile devices.Media grid wordpress responsive portfolio wordpress plugin

As functionalities there are among others: support for simple static images without viewer, an image slider fully responsive with video support and legends, an online builder of sliders, perfectly integrated into the grid resizing system, an audio player supporting a single song or playlist + SoundCloud, support for YouTube / Vimeo / Dailymotion or self-hosted videos, and much more.

Download | Demo | Web hosting

3. UpdraftPlus Backup and Restoration

This plugin requires you to do what every writer should do regularly (But does not do so !) - Save their work. " UpdraftPlus Backup Restore Is an automatic backup system.Updraftplus wordpress backup plugin wordpress

It even lets you choose where you want to store your backups, integrates with dropbox, Google Drive, Amazon S3, or simply with emails.

Lire aussi How to display your WordPress publications in a grid layout.

UpdraftPlus is one of the highest ranked backup plugins in the WordPress plugin directory, with over 800.000 active installations.

Download | Demo | Web hosting

Easily create your Online Store

Download free WooCommerce, the best e-commerce plugins to sell your physical and digital products on WordPress. [Recommended]

Recommended Resources

Find out about other recommended resources to help you build and manage your website.


Here ! That's it for this tutorial, I hope it allows you to stop storing WordPress comments IP addresses. 

However, you can also consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on WordPress blog creation.

If you have suggestions or remarks, leave them in our section Comments. Do not hesitate to share with your friends on your favorite social networks


This article features 0 comments

Leave a comment

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top