Want to learn how to stop storing your WordPress blog comment IP addresses?

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 127.0.0.1, which is an IP address generally used by localhost (locally).

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 code snippets into plugins/WordPress themes on WordPress, then you can use this method.

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' );

This is basically the same code used by the plugin we mentioned in the first method. However, instead of storing 127.0.0.1, it leaves the field blank. 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 delete the IP addresses of 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 your WordPress blog database by clicking on the database name in the column on the left. After that, you need 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.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern appearance and to optimize the handling 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 how 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 WordPress Plugin unique premium that allows you to easily create responsive, filterable and paginated portfolios in an unlimited way, taking advantage of the script of 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 WordPress plugin

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 among the highest ranked backup plugins in the directory of WordPress plugins, with more than 800.000 active installations.

Download | Demo | Web hosting

Recommended Resources

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

Conclusion

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

...