How to Stop Storing IP Address in WordPress Comments
Do you wish to cease storing IP addresses in your WordPress feedback?
By default, WordPress logs and shops the IP addresses of commenters to guard you towards spammers. That mentioned, with the rise of information privateness legal guidelines, you could wish to cease this performance to guard your web site customer information.
On this article, we are going to present you how one can cease storing IP addresses in WordPress feedback.
Ought to You Cease Storing IP Addresses in WordPress Feedback?
Until your commenters use a VPN, WordPress will retailer their IP addresses in your web site.
That is primarily used to combat spam comments from suspicious IP addresses. Some safety plugins may use IP addresses to place customers in a remark blacklist or block malicious IP addresses to stop threats like brute force attacks and DDoS assaults.
That mentioned, some customers could really feel uncomfortable realizing that their IP deal with is logged after they go away a remark. They could suppose that this data can be utilized towards them, which might make them hesitant to interact along with your WordPress website.
In case your web site caters to a world viewers, then storing IP addresses with out person consent can even make your website much less compliant with the General Data Protection Regulation (GDPR). It’s because the GDPR classifies IP addresses as private information.
Most WordPress hosting suppliers maintain uncooked entry logs of all guests to your web site for a restricted time period. Plus, you’ll be able to view these IP addresses when viewing the Feedback web page within the WordPress dashboard.
Now, let’s take a look at how one can cease storing IP addresses and enhance your WordPress security. Right here is an summary of what we are going to cowl:
How you can Cease Storing IP Addresses in WordPress Feedback
This primary methodology makes use of the WPCode plugin. We’ll use this plugin to insert a customized code snippet that stops your web site from storing IP addresses from the feedback part.
If that is your first time utilizing code, don’t fear. WPCode’s user-friendly interface makes it simple to insert and manage custom code, even for a newbie.
To make use of WPCode, it’s essential to set up the plugin first. For extra steerage, try our article on how to install a WordPress plugin.
Word: This text will use the WPCode free version, however be happy to improve to a Pro plan for extra superior options like conditional logic and scheduled snippets.
Now, it’s essential to go to Code Snippets » + Add Snippet out of your WordPress admin panel. After that, click on the ‘Use snippet’ button below ‘Add Your Customized Code Snippet’.
You’ll now see the Create Customized Snippet display.
First issues first, you must add a title on your code snippet. It may be one thing like ‘Disable IP Handle in Feedback.’
Within the Code Sort dropdown, select ‘PHP Snippet.’ Then, within the Code Preview field, you’ll be able to insert the next code:
perform wpb_remove_commentsip( $comment_author_ip ) { return ''; } add_filter( 'pre_comment_user_ip', 'wpb_remove_commentsip' );
After that, be sure that the toggle within the prime proper nook says ‘Lively’ and click on ‘Save Snippet.’
It ought to appear like this.
Now, the subsequent time somebody leaves a remark, you received’t see their IP deal with on the WordPress Comments web page.
Nevertheless, you’ll discover that earlier feedback nonetheless have this data saved. We’ll discuss extra about how one can take away this information within the subsequent a part of the tutorial.
To take away IP addresses out of your older WordPress feedback, you will have to make use of phpMyAdmin. It’s a database administration platform that often comes along with your WordPress internet hosting management panel.
Word: Earlier than you do something, we strongly suggest you back up your WordPress database first. That means, you’ll be able to restore the database should you make a crucial error.
When you do this, it’s essential to log in to your WordPress hosting account and search for the phpMyAdmin menu.
For Bluehost customers, one can find phpMyAdmin by going to ‘Web sites’ and deciding on the web site you wish to configure in your dashboard. It must be below ‘Fast Hyperlinks’.
Inside phpMyAdmin, you’ll be able to navigate to the ‘SQL’ tab.
After that, enter this question beneath:
UPDATE wp_comments SET comment_author_IP = '';
Word that if in case you have a custom WordPress database prefix, then please change wp_comments
to your customized desk prefix.
As soon as that’s performed, merely click on the ‘Go’ button beneath the textual content space to run your question.
At this stage, simply return to your WordPress Feedback web page to see if the question labored correctly. That’s it!
We hope this text has helped you discover ways to cease storing IP addresses in WordPress feedback. You might also wish to see our skilled picks for the best WordPress security plugins and our information to the tell-tale signs hackers have hijacked your WordPress site.
Should you favored this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You may as well discover us on Twitter and Facebook.