Title: Cloudflare Geolocation
Last modified: December 17, 2021

---

# Cloudflare Geolocation

 *  [jackc1992](https://wordpress.org/support/users/jackc1992/)
 * (@jackc1992)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/cloudflare-geolocation/)
 * Hello,
 * Im getting to grips with your plugin and it’s AWESOME.
 * I have a little request that’s over my technical ability.
 * I have Cloudflare Geolocation which allows me to capture the country code for
   the user’s IP with this:
 * $country_code = $_SERVER[“HTTP_CF_IPCOUNTRY”];
 * Is it possible to take this and create an ‘if’ statement that would compare the
   user IP with an ACF field for country codes e.g
 * [If $country_code and field=country_codes keyword=GB]
    //this text// [if]

Viewing 1 replies (of 1 total)

 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/cloudflare-geolocation/#post-15180787)
 * You can use it if you can get it into a variable. Build for example a short-code
   returning the country-code from Cloudflare, set a variable with it and use the
   variable in the if clause.

Viewing 1 replies (of 1 total)

The topic ‘Cloudflare Geolocation’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [polarracing](https://wordpress.org/support/users/polarracing/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/cloudflare-geolocation/#post-15180787)
 * Status: not resolved