How to Stop Storing IP Address in WordPress Comments

0
62

Do you need to cease storing IP addresses in your WordPress feedback?

By default, WordPress logs and shops the IP addresses of commenters to defend you in opposition to spammers. That stated, with the rise of knowledge privateness legal guidelines, you might have considered trying to cease this performance to defend your web site customer knowledge.

In this text, we are going to present you ways to cease storing IP addresses in WordPress feedback.

How to Stop Storing IP Address in WordPress CommentsHow to Stop Storing IP Address in WordPress Comments

Should You Stop Storing IP Addresses in WordPress Comments?

Unless your commenters use a VPN, WordPress will retailer their IP addresses in your web site.

This is principally used to combat spam comments from suspicious IP addresses. Some safety plugins can also use IP addresses to put customers in a remark blacklist or block malicious IP addresses to forestall threats like brute force attacks and DDoS assaults.

That stated, some customers might really feel uncomfortable realizing that their IP tackle is logged after they depart a remark. They might imagine that this data can be utilized in opposition to them, which may make them hesitant to interact along with your WordPress website.

If your web site caters to a worldwide viewers, then storing IP addresses with out person consent may make your website much less compliant with the General Data Protection Regulation (GDPR). This is as a result of the GDPR classifies IP addresses as private knowledge.

Most WordPress webhosting 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 Comments web page in the WordPress dashboard.

Now, let’s have a look at how to cease storing IP addresses and enhance your WordPress security. Here is an summary of what we are going to cowl:

This first technique makes use of the WPCode plugin. We will 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 straightforward to insert and manage custom code, even for a newbie.

To use WPCode, you want to set up the plugin first. For extra steerage, take a look at our article on how to install a WordPress plugin.

Note: This article 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, you want to go to Code Snippets » + Add Snippet out of your WordPress admin panel. After that, click on the ‘Use snippet’ button beneath ‘Add Your Custom Code Snippet’.

Adding custom CSS in WPCodeAdding custom CSS in WPCode

You will now see the Create Custom Snippet display.

First issues first, you might have to add a title on your code snippet. It might be one thing like ‘Disable IP Address in Comments.’

In the Code Type dropdown, select ‘PHP Snippet.’ Then, in 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 in the highest proper nook says ‘Active’ and click on ‘Save Snippet.’

It ought to appear like this.

Removing IP addresses in the comments using WPCodeRemoving IP addresses in the comments using WPCode

Now, the following time somebody leaves a remark, you received’t see their IP tackle on the WordPress Comments web page.

However, you’ll discover that earlier feedback nonetheless have this data saved. We will discuss extra about how to take away this knowledge in the following a part of the tutorial.

What the comment looks like after removing the IP address using WPCodeWhat the comment looks like after removing the IP address using WPCode

To take away IP addresses out of your older WordPress feedback, you have to to use phpMyAdmin. It’s a database administration platform that normally comes along with your WordPress internet hosting management panel.

Note: Before you do something, we strongly suggest you back up your WordPress database first. That means, you’ll be able to restore the database if you happen to make a vital error.

Once you try this, you want to log in to your WordPress hosting account and search for the phpMyAdmin menu.

For Bluehost customers, you will see phpMyAdmin by going to ‘Websites’ and choosing the web site you need to configure in your dashboard. It ought to be beneath ‘Quick Links’.

Navigating to the phpMyAdmin in BluehostNavigating to the phpMyAdmin in Bluehost

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

Note that if in case you have a custom WordPress database prefix, then please change wp_comments to your customized desk prefix.

Once that’s carried out, merely click on the ‘Go’ button beneath the textual content space to run your question.

Removing IP addresses in older WordPress comments using phpMyAdminRemoving IP addresses in older WordPress comments using phpMyAdmin

At this stage, simply return to your WordPress Comments web page to see if the question labored correctly. That’s it!

We hope this text has helped you find out how to cease storing IP addresses in WordPress feedback. You can also need to see our knowledgeable picks for the best WordPress security plugins and our information to the tell-tale signs hackers have hijacked your WordPress site.

If you preferred this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You may discover us on Twitter and Facebook.



Source link