How to Stop Storing IP Address in WordPress Comments
How to ensure that IP address is not stored in the WordPress comments
It is a common question among the WordPress users if the IP address can be stopped from being stored in the WordPress comments. Many WordPress site owners actually want to do this so that they can ensure that the privacy of their users can be protected. In this article we will exactly discuss this that how you can ensure that the IP address is not stored in the WordPress comments as a result the privacy of the users can be protected. We hope that you will find this article informative.
Pros and cons of not storing the IP address in the WordPress comments
We all know that it is a default setup in WordPress that ensures that the IP address of those who are visiting the site and giving comments is stored in the database of the site. It also ensures that these IP addresses are actually stored permanently. The question arises why does WordPress ensure that these IP addresses are stored? Well the answer is simple. It is basically done to ensure that site owners can deal with the comments and that are spam are not wanted. There are some plugins like the Akismet that can actually successfully block the comments from the IP address as these IP addresses can be used by those who intend to do a spam for wrong purpose.
Until and unless the users are using the VPN service the real IP addresses can still be found in the logs of your site. Here we must mention that most of the WordPress hosting providers ensure that they keep an access log of all visitors who are visiting the website for a certain period of time.
We hope that by now you have got a clear idea on how storing the IP address of the users in the WordPress comments can help you as well as your site. We will now explain the other aspect of the issue. What happens if you are not storing the IP address in the comments? When you do this you are basically keeping the users first and ensuring that the privacy of the users is protected. Many users prefer that their IP address is not stored in the site and their privacy is protected. They feel more confident to express their view in such sites and they are willing to come back to such sites. Many users actually look for sites that will not store the IP address.
Now that you know the pros and cons of ensuring that the IP address is not being stored in the WordPress comment we can move on to the next part of the article where we will explain how you can ensure that the IP addresses are not stored. There are two methods that you can implement in order to do this and they are:
Method 1: With the help of a WordPress plugin you can ensure that the IP address is not stored in the comments – We will suggest that this is an easier method and we recommend it to all those who are new to the WordPress. To do this the WordPress plugin that you will need is called the Remove IP plugin. Once you get the plugin just follow the step by step methods we have mentioned on installing and activating WordPress plugins in one of our previous articles.
After the WordPress Remove IP plugin has been installed and activated you will notice that the plugin will replace your site users IP address with 127.0.0.1 this is an IP address that is usually used by the localhost.
One point that you must be told about the Remove IP plugin is that it will not be able to delete the IP addresses that are stored in the older comments. If you have older comments that have the IP addresses stored in them then you will have to delete them using a different method and we will be explaining how to do that later in this article. As of now we are moving to the second method that involves deleting the IP addresses manually.
Method 2: Manually stop storing the IP address in the WordPress comments – This is a more complicated method and we will recommend it to only those who have a good knowledge of the codes that you use in WordPress. What you will have to do is add the enclosed code that we are attaching to the theme’s function.php file or to the site specific plugin.
If you look at the code closely you will notice that it is very similar to the code that is used by the plugin that we have mentioned in the first method. However, the difference is that instead of storing 127.0.0.1 in the IP field it will leave the IP field as blank.
How to remove the IP address from the old comments
No matter which of the above two method you use to delete the IP address from the comments the fact remains that both the methods will not delete the IP address from the comments that have been already posted in the WordPress site. If you want to delete the IP address from the old comments then you will have to follow the method that we are about to discuss now.
You will have to run a MySql query on the WordPress database. Before you do that ensure that you do have the latest WordPress database backup. After that you will have to login to the WordPress hosting control panel and look for phpMyAdmin.
Once you have done that you will have to choose the WordPress database of yours by clicking on the database name in the column that you will find in the left hand side. In the next step you will have to click on the SQL menu as shown in the screenshot that we have attached below.
Once you have done this you will be taken to the text area where you will have to enter the query that we have enclosed below.
After that you will have to enter the “go” button that you will find in the text area in order to run the query. Once you do this all the IP addresses that are stored with the comments in your site’s database will be deleted. One point that we must mention here is that if you have a custom WordPress database prefix then you will have to adjust the WP_comments to the custom table prefix of yours.
Actually speaking there is a lot that you can actually do with the WordPress sites. We hope that after reading this article you will be able to get a better idea about how you can ensure that the IP address is not stored in the comments that are posted in your WordPress site. This can ensure that the users who are coming to your site enjoy a better experience and they keep coming back. After all we want that the people who are regularly coming to our site keep coming and keep posting their valuable feedbacks and comments on our posts.