Hello,
Please can you help me with this…
I’m trying to create a looper based on a custom query string
I have this query where the variable $country_code looks up the IP location and outputs a country code
$country_code = $_SERVER[“HTTP_CF_IPCOUNTRY”];
$args = array(
‘meta_key’ => ‘country’,
‘meta_value’ => $country_code,
‘meta_compare’ => ‘contains’
);
$query = new WP_Query( $args);
Then I’m using … var_dump( http_build_query( $query ) ); to generate my query string
however, when this happens, the variable $country_code is appearing as the country code of my IP e.g. GB
i need $country_code to stay as a variable so it updates depending on the users IP location.
Thanks!