As experienced WordPress developers who've managed countless sites, we've seen privacy concerns firsthand. After our guide on anonymous commenting, readers asked how to prevent IP storage in comments. This boosts user trust and compliance. Here's our proven step-by-step approach.

WordPress stores commenter IP addresses by default in its database for spam detection, aiding tools like Akismet. However, hosting access logs often retain real IPs temporarily (unless using VPNs).
Not storing IPs enhances privacy, encouraging open discussions. Drawback: Slightly harder spam tracking, but logs and anti-spam plugins suffice for most sites.
Recommended for new sites. Install and activate the Remove IP plugin—see our step-by-step plugin installation guide.
It swaps user IPs with 127.0.0.1 (localhost). Existing comments remain unchanged; clean them up later as detailed below.
Add this to your theme's functions.php or a custom plugin:
function wpb_remove_comment_ip( $comment_author_ip ) {
return '';
}
add_filter( 'pre_comment_user_ip', 'wpb_remove_comment_ip' );This blanks the IP field entirely, mirroring plugin logic but without localhost fallback.
Past comments retain IPs regardless of method. To remove them:
Critical: Back up your WordPress database first.
Log into your hosting control panel, access phpMyAdmin, select your WordPress database, and click SQL.

Run this query:
UPDATE wp_comments SET comment_author_IP = '';Click Go. All IPs are now cleared. Note: Replace wp_ with your custom table prefix if different.
This guide, tested across production sites, ensures privacy without compromising security. Related: Add Anonymous Ask Me Features.
Liked this? Subscribe to our YouTube channel for video tutorials. Follow us on Twitter and Facebook.