Plugin Author
pipdig
(@pipdig)
Hi amis77,
This message means that the geolocation data from CloudFlare is not accessible via PHP for some reason.
It may be worth double checking that the IP Geolocation option is enabled in your CloudFlare dashboard – http://imgur.com/jOzbN3z
If that option is definitely enabled, then the issue is likely coming from your web hosting. You should ask if they have installed mod_CloudFlare on the server. To be honest though, it should work either way if you also have the CloudFlare WordPress plugin installed, as this works around that issue.
In your CloudFlare settings, you should also check that the DNS records for this site are not “Gray Clouded” – https://support.cloudflare.com/hc/en-us/articles/200169626-What-subdomains-are-appropriate-for-orange-gray-clouds
Let me know how you get on!
Phil
Thread Starter
amis77
(@amis77)
Geolocation is definitely enabled and DNS is orange clouded, so I have no idea what’s wrong. I’ll ask my host about mod_CloudFlare on its server. Thanks!
Plugin Author
pipdig
(@pipdig)
You could also try adding this to one of your theme’s functions.php file:
function pipdig_test_geolocation_shortcode( $atts, $content = null ) {
if (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) {
return strip_tags($_SERVER['HTTP_CF_IPCOUNTRY']);
}
return;
}
add_shortcode( 'where_am_i', 'pipdig_test_geolocation_shortcode' );
You can then add the shortcode [where_am_i]
to a testing page/post on your site and it should display a 2-letter country code of your current location.
If nothing is displayed, then geolocation is not working for some reason. If the country code is displayed, then it will at least give us something to check in the plugin.
Let me know 🙂
Phil