How to Enable GDPR Without Removing the Smart Phone IP Auto-detection

Overview

Do you have a form with GDPR and finding that the Smart Phone IP detection isn’t picking up the country code for your form? When GDPR Enhancements are enabled, this disables the IP address detection which the Smart Phone field uses to determine the country code. In this tutorial, we’ll walk you through the steps on how to allow the IP Auto-detection while still having GDPR enabled.

Please note, by using this snippet you could be breaking your GDPR agreement. It’s best to research the agreement in your country with legal advice to determine if using this snippet violates the GDPR agreement in your country.

Setup

Simply copy this code snippet to your site.

/*
 * Hide the price from notifications
 *
 * @link https://wpforms.com/developers/how-to-enable-gdpr-without-removing-smart-phone-ip-auto-detection
 *
 */

function wpf_wpforms_frontend_strings( $strings ) {
 $strings['gdpr'] = false;
 return $strings;
}
add_filter( 'wpforms_frontend_strings', 'wpf_wpforms_frontend_strings', 10, 1 );

The above code will be applied to all forms that use the Smart Phone form field.

And that’s all you need to stay compliant with GDPR while also keeping the IP detection. Would you like to separate that country code from the Smart Phone field for a unique styling look? Take a look at our tutorial on How to Separate Dial Code From Smart Phone Form Field Dropdown.

Filter Reference: wpforms_frontend_strings