After reading our entire article on how to create a custom Add to Cart URL in WooCommerce, one of my readers asked me how to stop storing the IP address of the people who write comments on my blog articles or who leave product reviews on my WooCommerce products.
Many bloggers or site owners want to do that in order to protect their audience privacy. In this article, I have explained to you how to stop storing the IP address of the user who leaves a comment on your WordPress blog or WooCommerce Products as product reviews.
Pros and Cons of not storing an IP address in WordPress comments
Natively, WordPress stores the IP addresses of people who leave comments on your website. These unique IP addresses are stored in your WordPress database until you manually delete them.
There is a reason for storing an IP address with each comment in WordPress. It helps the site owner to combat unwanted and spamming comments. The popular WordPress plugin Akismet block comments from those IP addresses which are exploited by spammers.
If your user is using a Virtual Private Network (VPN) then his/her IP address cannot be found in your site’s log otherwise you can have the real IP address in your site log.
There are many web hosting providers who have access log to all the visitors for a limited juncture of time like Cloudways, WP Engine, Kinsta, etc.
You can improve the privacy of your website commenter by not storing his IP address in your WordPress comments. This makes him more confident that you are not storing any of his IP address details to your website and will enhance him to write his comment without any worry.
Method 1: By using a WordPress plugin
Well, if you are a newbie and have a weak hand on the coding part then this method is recommended for you which is easier and quicker.
Step 1: You need to install the Remove IP(by guid0) plugin which is free to download from WordPress.org directory.
Step 2: Activate the plugin.
Now, once you activate this plugin, the original IP address of the user will be replaced by a default localhost IP address which is 127.0.0.1.
This plugin does not delete any of the existing IP address in your site’s older comments. If you have IP addresses in the older comments then those IP addresses need to be deleted too which I have explained at the end of this article.
Method 2: By adding a code snippet in functions.php file
If you are familiar with copying and pasting the code snippets in WordPress then this is the best method for you.
Just go to your theme’s functions.php file and paste this code at the very end.
function wsg_remove_commentsip( $comment_author_ip )
{
return ”;
}
add_filter( ‘pre_comment_user_ip’, ‘wsg_remove_commentsip’ );
This code working mechanism is same as of the plugin mentioned in method 1. I do not recommend to use a lot of plugins as they slow down your WordPress website. If you are also the one who is facing speed issues with WordPress website then switch your website to Cloudways for faster loading.
Method 3: Removing IP address from older comments
It’s total up to you of what method you choose to stop storing the IP addresses on WordPress comments but the older comments still have IP addresses stored with them.
And of course, as you are spending time to read this entire article, you may want to remove those IP address which is already stored with older comments.
I will show you by running one line of MySQL query on your WordPress database but make sure that you have downloaded the most recent WordPress database backup.
Now, follow these steps to run the MySQL query.
Step 1: Login into your web hosting cPanel.
Step 2: Search for phpMyAdmin option.
Step 3: Now, click on your WordPress website database in the left column. (Don’t know what database it is? Go to your website’s wp-config.php file and check what database name is written over there).
Step 4: Click on the SQL menu.
Paste the code given below in the white area under the SQL menu and hit the “Go” button to run this query.
UPDATE ‘wp_comments’ SET ‘comment_author_IP’ = ”;
Once you click on the “Go” button, this query executes and will remove all the existing IP addresses in your WordPress older comments.
I hope this article helped you to stop storing IP addresses with comments on the WordPress website.
Please subscribe to my Youtube channel for video tutorials and follow me on Twitter and Facebook for social media engagement.
How to Stop Storing IP Address of WordPress Commenters – 2 Easy Methods
After reading our entire article on how to create a custom Add to Cart URL in WooCommerce, one of my readers asked me how to stop storing the IP address of the people who write comments on my blog articles or who leave product reviews on my WooCommerce products.
Many bloggers or site owners want to do that in order to protect their audience privacy. In this article, I have explained to you how to stop storing the IP address of the user who leaves a comment on your WordPress blog or WooCommerce Products as product reviews.
Pros and Cons of not storing an IP address in WordPress comments
Natively, WordPress stores the IP addresses of people who leave comments on your website. These unique IP addresses are stored in your WordPress database until you manually delete them.
There is a reason for storing an IP address with each comment in WordPress. It helps the site owner to combat unwanted and spamming comments. The popular WordPress plugin Akismet block comments from those IP addresses which are exploited by spammers.
If your user is using a Virtual Private Network (VPN) then his/her IP address cannot be found in your site’s log otherwise you can have the real IP address in your site log.
There are many web hosting providers who have access log to all the visitors for a limited juncture of time like Cloudways, WP Engine, Kinsta, etc.
You can improve the privacy of your website commenter by not storing his IP address in your WordPress comments. This makes him more confident that you are not storing any of his IP address details to your website and will enhance him to write his comment without any worry.
Method 1: By using a WordPress plugin
Well, if you are a newbie and have a weak hand on the coding part then this method is recommended for you which is easier and quicker.
Step 1: You need to install the Remove IP(by guid0) plugin which is free to download from WordPress.org directory.
Step 2: Activate the plugin.
Now, once you activate this plugin, the original IP address of the user will be replaced by a default localhost IP address which is 127.0.0.1.
This plugin does not delete any of the existing IP address in your site’s older comments. If you have IP addresses in the older comments then those IP addresses need to be deleted too which I have explained at the end of this article.
Method 2: By adding a code snippet in functions.php file
If you are familiar with copying and pasting the code snippets in WordPress then this is the best method for you.
Just go to your theme’s functions.php file and paste this code at the very end.
function wsg_remove_commentsip( $comment_author_ip )
{
return ”;
}
add_filter( ‘pre_comment_user_ip’, ‘wsg_remove_commentsip’ );
This code working mechanism is same as of the plugin mentioned in method 1. I do not recommend to use a lot of plugins as they slow down your WordPress website. If you are also the one who is facing speed issues with WordPress website then switch your website to Cloudways for faster loading.
Method 3: Removing IP address from older comments
It’s total up to you of what method you choose to stop storing the IP addresses on WordPress comments but the older comments still have IP addresses stored with them.
And of course, as you are spending time to read this entire article, you may want to remove those IP address which is already stored with older comments.
I will show you by running one line of MySQL query on your WordPress database but make sure that you have downloaded the most recent WordPress database backup.
Now, follow these steps to run the MySQL query.
Step 1: Login into your web hosting cPanel.
Step 2: Search for phpMyAdmin option.
Step 3: Now, click on your WordPress website database in the left column. (Don’t know what database it is? Go to your website’s wp-config.php file and check what database name is written over there).
Step 4: Click on the SQL menu.
Paste the code given below in the white area under the SQL menu and hit the “Go” button to run this query.
UPDATE ‘wp_comments’ SET ‘comment_author_IP’ = ”;
Once you click on the “Go” button, this query executes and will remove all the existing IP addresses in your WordPress older comments.
I hope this article helped you to stop storing IP addresses with comments on the WordPress website.
Please subscribe to my Youtube channel for video tutorials and follow me on Twitter and Facebook for social media engagement.
You might be interested in these posts too:
WPEngine Review
Flywheel hosting review
Complete Blogging Guide
Why WordPress?
Create a Multi-language Website
WPEngine Coupon Code
Share:
More Posts
Free Local Server for WordPress Website
No doubt, WordPress is a very powerful content management system which can be used to build amazing websites. Though WordPress is an open-source tool but
WhatsApp Chat on WordPress Website 2024
In this article, you will learn How to add Whatsapp Chat on WordPress Website. In earlier days, you were having only the basic contact forms
How to Backup WordPress site for Free with UpdraftPlus
Last Update: 8 March 2019. Backups are very important in terms of your WordPress website security against threats. Regular backups are one of the most
5 Best Contact Form Plugins for WordPress in 2024
Hey! Are you looking to add a contact form on your WordPress website? Not yet decided which one is the best contact form plugin to
Send Us A Message