Title: Location not recognised
Last modified: February 6, 2018

---

# Location not recognised

 *  [tripinsider](https://wordpress.org/support/users/tripinsider/)
 * (@tripinsider)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/location-not-recognised/)
 * The plugin does not recognise the IP location anymore. It is always displaying
   the US link, even that the UK is selected as the default country.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Flocation-not-recognised%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [paulstuttard](https://wordpress.org/support/users/paulstuttard/)
 * (@paulstuttard)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-9944617)
 * First things first, if you visit [http://www.ip2nation.com](http://www.ip2nation.com)
   you can double check that your IP is being correctly recognised as a UK one.
 * Be aware that if you are running any third party caching software that will cache
   only one version of the page, so any change of locale will not be reflected in
   the pages displayed.
 * You could try installing the `Amazon Link Extra - Spoof Locale` plugin and changing
   the locale that should be displayed by adding `?spoof_locale=uk` to the url, 
   e.g. [http://www.tripinsiders.net/?spoof_locale=uk](http://www.tripinsiders.net/?spoof_locale=uk)
 * Paul
 *  Thread Starter [tripinsider](https://wordpress.org/support/users/tripinsider/)
 * (@tripinsider)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-9944655)
 * Hi Paul,
 * Yes, I can see that ip2nation is detecting the country with no problem. Why would
   the plugin use all the time the link to US? I have tried from different countries(
   using proxies and remote desktop) and there is no change at all. It was working
   ok some time ago so I suspect it was an update.
 * Can you give a hint of where to debug or try to find the problem?
 * Cheers
 *  Thread Starter [tripinsider](https://wordpress.org/support/users/tripinsider/)
 * (@tripinsider)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-9955841)
 * Hi Paul,
 * Could you please let me know the file and/o function where the country is detected
   and the default link rendered so I can debug it?
 * Cheers
 *  Thread Starter [tripinsider](https://wordpress.org/support/users/tripinsider/)
 * (@tripinsider)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-9955921)
 * I am using cloudflare. Could this be the root cause of the problem?
 *  Thread Starter [tripinsider](https://wordpress.org/support/users/tripinsider/)
 * (@tripinsider)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-9956270)
 * So yes I found that Cloudflare was the problem, as ip2n->get_cc() was returning‘
   eu’. As a quick fix, I enabled GeoLocation on Cloudflare and I changed amazon.
   php to use $_SERVER[“HTTP_CF_IPCOUNTRY”] (set by Cloudflare) instead of ip2n.
 *  Plugin Author [paulstuttard](https://wordpress.org/support/users/paulstuttard/)
 * (@paulstuttard)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-9956895)
 * Excellent work, sorry I could not be more help (busy at work), I’ll investigate
   building that into the plugin.
 * Paul
 *  Thread Starter [tripinsider](https://wordpress.org/support/users/tripinsider/)
 * (@tripinsider)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-9956905)
 * I think a simple configuration such as “Use Cloudflare GeoLocation HTTP header”
   would do it. You then use ip2n->get_cc() or $_SERVER[“HTTP_CF_IPCOUNTRY”] accordingly
 *  Thread Starter [tripinsider](https://wordpress.org/support/users/tripinsider/)
 * (@tripinsider)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-10408351)
 * Hi Paul,
 * I just upgraded the plugin and I lost the fix for cloudflare. Are you planning
   to include it?
 * Cheers
 *  Thread Starter [tripinsider](https://wordpress.org/support/users/tripinsider/)
 * (@tripinsider)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-10408379)
 * Hi Paul,
 * I just saw you actually added it. I think you need the following correction:
 * strtolower($_SERVER[“HTTP_CF_IPCOUNTRY”]);
 * Cheers
 *  Plugin Author [paulstuttard](https://wordpress.org/support/users/paulstuttard/)
 * (@paulstuttard)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-10408780)
 * Hi, Sorry – I don’t use cloud flare so did not test the fix, but I’ll put your
   change into the next version of the plugin.
 * Paul

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

The topic ‘Location not recognised’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/amazon-link_070606.svg)
 * [Amazon Link](https://wordpress.org/plugins/amazon-link/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amazon-link/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amazon-link/)
 * [Active Topics](https://wordpress.org/support/plugin/amazon-link/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amazon-link/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amazon-link/reviews/)

## Tags

 * [ip2nation](https://wordpress.org/support/topic-tag/ip2nation/)

 * 10 replies
 * 2 participants
 * Last reply from: [paulstuttard](https://wordpress.org/support/users/paulstuttard/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/location-not-recognised/#post-10408780)
 * Status: not resolved