Title: Wrong IP detected?
Last modified: August 30, 2016

---

# Wrong IP detected?

 *  Resolved [gdelgado](https://wordpress.org/support/users/gdelgado/)
 * (@gdelgado)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/wrong-ip-detected/)
 * Hello,
    I’m from Portugal, my IP and location gets correct detected at [https://www.whatismyip.com/](https://www.whatismyip.com/)
   but the plugin detects a different IP address and says that I’m from US… what
   might be wrong?
 * I have cloudflare enabled on this website and even if I Pause cloudflare, IP 
   it still gets wrongly detected.
 * Thanks!
 * [https://wordpress.org/plugins/ip-geo-block/](https://wordpress.org/plugins/ip-geo-block/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/wrong-ip-detected/#post-6538176)
 * Hi gdelgado,
 * What do you see at “**Your IP address / Country**” on the top of “**Settings**”
   tab. I think your IP address is within [the ranges of CloudFlare](https://www.cloudflare.com/ips).
   This plugin just uses `$_SERVER['REMOTE_ADDR']` to get the visitor’s IP. But 
   behind the proxy like CloudFlare, all the visitor’s IP will be the CloudFlare’s
   IP. To get the original IP, you can add the following code in your `functions.
   php`.
 * `$_SERVER['REMOTE_ADDR'] = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["
   HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];`
 * Please refer to the followings:
    [https://support.cloudflare.com/hc/en-us/articles/200170856-How-do-I-restore-original-visitor-IP-with-vBulletin-](https://support.cloudflare.com/hc/en-us/articles/200170856-How-do-I-restore-original-visitor-IP-with-vBulletin-)
   [http://stackoverflow.com/questions/14985518/cloudflare-and-logging-visitor-ip-addresses-via-in-php](http://stackoverflow.com/questions/14985518/cloudflare-and-logging-visitor-ip-addresses-via-in-php)
 * Please try the above code and let me know the result !
 * Thanks for your asking.
 *  Thread Starter [gdelgado](https://wordpress.org/support/users/gdelgado/)
 * (@gdelgado)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/wrong-ip-detected/#post-6538258)
 * It worked.
    Fantastic! Thanks
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/wrong-ip-detected/#post-6538259)
 * Glad to hear that!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Wrong IP detected?’ is closed to new replies.

 * ![](https://ps.w.org/ip-geo-block/assets/icon-128x128.png?rev=1148568)
 * [IP Geo Block](https://wordpress.org/plugins/ip-geo-block/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ip-geo-block/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ip-geo-block/)
 * [Active Topics](https://wordpress.org/support/plugin/ip-geo-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ip-geo-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ip-geo-block/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/wrong-ip-detected/#post-6538259)
 * Status: resolved