close
commentprivacy

Many users want to know that is it possible to stop storing in comments. Some may want to do it for security reasons and others to protect privacy. This article will explain stop storing IP address in WordPress comments.

Pros and Cons of Not Storing IP Address in WordPress Comments

WordPress logs and stores IP addresses of users leaving comments on your website by default. These IP addresses are permanently stored in your database.

The reason is to tackle unwanted comments and spam. Plugins like Akismet can block comments from IP addresses known to be exploited by spammers.

If users are not using a VPN service, their real IP address can still be found in your site logs. Most WordPress hosting providers keep an access log of all visitors to your website for a limited period of time.

On the other hand if users are not storing IP addresses of its commenters on your website then they may feel protected and confident and will be able to express their opinion more openly.

Method 1: Stop Storing IP Addresses in Comments with Plugin

This is an easier method and recommended for beginners. First you need to install and activate Remove IP plugin. Once it’s activated the plugin will replace user IP with 127.0.0.1, which is an IP address typically used by localhost. The plugin will not delete IP addresses stored with older comments. If you have older comments with IP addresses stored with them, then you may want to delete those IP addresses as well. We will show you how to do that later in this article.

Method 2: Manually Stop Storing IP Addresses with WordPress Comments

This is an advanced method and not recommended for users who are not comfortable with pasting code snippets in WordPress.

Simply add this code to your theme’s functions.php file or a site-specific plugin.

1function wpb_remove_commentsip( $comment_author_ip ) {

 

2return ”;

 

3}

 

4add_filter( ‘pre_comment_user_ip’, ‘wpb_remove_commentsip’ );

 

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 IP field blank.

Remove IP Address From Old Comments

Whichever method you use to stop storing comments IP, old comments will still always have IP addresses stored with them. If you have old comments on your site, then you may want to remove IP addresses from those comments. We will show you how to do that by running a MySQL query on your WordPress database. It is really important to make sure that you have the most recent WordPress database . Next you need to login to your WordPress hosting control panel and look for phpMyAdmin.

Make sure that you have selected your WordPress database by clicking on the database name in the column on your left hand. After that you need to click on the SQL .

removeipmysql

This will bring you a text area where you need to enter this query:

1UPDATE ‘wp_comments’ SET ‘comment_author_IP’ = ”;

 

Click on the Go button below the textarea to run your query. It will remove all IP addresses stored with comments in WordPress database.

 

 

Tags : ip addresswordpressWordPress how to
Nooruddin Ahmed

The author Nooruddin Ahmed

An avid football fan. Lives for the weekend game.Aviation enthusiast. Believes in letting bygones be bygones.

Leave a Response