• Resolved bügelfrei

    (@alexanderbailey)


    I tried adding
    add_filter( 'wpcf7_remote_ip_addr', 'wpcf7_anonymize_ip_addr' );
    to my functions.php, but in my tests I am still seeing my full IP address in Flamingo.

    Could it be the position of the code in my functions file? Do I need to set a priority parameter with the function?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter bügelfrei

    (@alexanderbailey)

    The form on this staging page is now set to mail me (so you are welcome to test it):
    https://sf.nnalphastaging.wpengine.com/contact/

    Thank you!

    I also have same problem. Have added the code add_filter( ‘wpcf7_remote_ip_addr’, ‘wpcf7_anonymize_ip_addr’ ); to bottom of astra child theme functions.php but still seeing my IP address come up in Flamingo when running tests.

    Can you help please?

    Hello @alexanderbailey and @scribo,

    What you have to take into consideration is that the function wpcf7_anonymize_ip_addr() only hides the last part of an IP address. For example, if the IP address (IPv4) is 192.168.0.255, it will become 192.168.0.0. Please read Anonymizing IP address for more details.

    If you want to hide the IP address completely, you can pass the 0.0.0.0 pattern and absolutely no information will be stored. This code snippet can be used for that purposes:

    // Hide users IP addresses completely
    add_filter( 'wpcf7_remote_ip_addr', function(){	return '0.0.0.0'; } );

    Now, the IP addresses from the visitors will be converted to 0.0.0.0.

    Hope this help you.

    PD: I already tested this code snippet in an Astra child theme and works 😉

    Best regards,
    Yordan.

    Thanks @yordansoares that works perfectly! It would be useful to see the first part of the IP however. The code add_filter( ‘wpcf7_remote_ip_addr’, ‘wpcf7_anonymize_ip_addr’ ); doesn’t even hide the last part of an IP for me… it displays it fully. Am I missing something in the code?

    Thanks!

    That’s weird @scribo, do you have installed the lastest release of Contact Form 7? You need at least the version 5.0.3 in order to use this función.

    @yordansoares I do indeed – CF7 version 5.3. All other software is up to date. Any ideas?

    Thread Starter bügelfrei

    (@alexanderbailey)

    I’m happy to report that wpcf7_anonymize_ip_addr() is working for now. The last chunk of IPv4 addresses is being converted to 0.

    This is the code I have in my functions.php:

    if (function_exists( 'wpcf7_anonymize_ip_addr' )){
    add_filter( 'wpcf7_remote_ip_addr', 'wpcf7_anonymize_ip_addr' );
    }
    • This reply was modified 3 years, 4 months ago by bügelfrei. Reason: Fixed typo in position of closing CODE tag

    Thanks @alexanderbailey that works perfectly!

    Thread Starter bügelfrei

    (@alexanderbailey)

    This is resolved for me.

    Using this ufficial code into function.php

    add_filter( 'wpcf7_remote_ip_addr', 'wpcf7_anonymize_ip_addr' );

    the IP (for example) 192.168.0.255 is converted to 192.168.0.0 (without last tre numers). I tested this with Flamingo

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Anonymizing Remote IP Address: Not Working’ is closed to new replies.