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

Do you want to enable GDPR without removing the IP auto-detection? When GDPR Enhancements are enabled, this disables the IP address detection which the Smart Phone field uses to determine the country code. In this article, we’ll walk you through the steps to allow the IP Auto-detection while still having GDPR enabled.

Please note that you could be breaking your GDPR agreement by using this snippet. 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.

Enabling GDPR without IP auto-detection

To begin, you’ll need to add this snippet to your site.

If you need assistance on how and where to add snippets to your site, please review this tutorial.

/*
 * 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 also restrict countries for a Smart Phone field as well? Take a look at our tutorial on How to Restrict Countries Inside Smart Phone Form Fields.

Reference Filter

wpforms_frontend_strings