Store Shortened IP Addresses for Contact Form 7 Submissions
Shortens the visitor IP address that Contact Form 7 records with each submission (used in mail tags and by Flamingo and spam filters), so a full address is never kept.
Opens WPIDE on
Code
add_filter( 'wpcf7_remote_ip_addr', function ( $ip ) {
return $ip ? wp_privacy_anonymize_ip( $ip ) : $ip;
} );
Notes
Return an empty string instead to drop the IP address entirely; spam protection that relies on it may become less accurate.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.