A Cloudflare mascara o endereço IP do usuário e o move para outro cabeçalho HTTP.
To make it compatible with ThirstyAffiliate’s stats collection module you will need to add the following snippet of code to your functions.php file or a drop-in plugin.
função ta_cloudflare_ip_compatibility( $ip ) {
if ( ! empty( $_SERVER['HTTP_CF_CONNECTING_IP'] ) )
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
return $ip;
}
add_filter( 'ta_get_user_ip_address' , 'ta_cloudflare_ip_compatibility' , 10 , 1 );
Isso será adicionado como um recurso ao ThirstyAffiliates no futuro.
Adicione o seguinte trecho de código ao seu arquivo functions.php ou a um plug-in drop-in para o módulo Geolocations ao redirecionar:
function get_proper_ip_from_cf_for_ta_geo($address) {
if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) && !empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$address = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
return $address;
}
add_filter('tap_geolocation_client_ip', 'get_proper_ip_from_cf_for_ta_geo');