Real IP for the customers [CloudFlare]
-
Hello,
I face a problem to get the real IP for the customers when they make a new order because I’m using the CloudFlare I put this inside wp-config:
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}It’s Work for the Real IP for comments only, I tried this code inside function.php but it’s not working:
add_filter('woocommerce_get_customer_ip_address', 'get_customer_real_ip', 10, 1);
function get_customer_real_ip($customer_ip) {
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$customer_ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
return $customer_ip;
}Please help to Get Real IP for the customers
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.