From c960f21fcb1cb1249c708d4b5c782e62f41b2895 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Wed, 24 Jan 2024 14:16:28 +0100 Subject: [PATCH] gtm4wp_get_user_ip() did not return REMOTE_ADDR by default --- public/frontend.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/frontend.php b/public/frontend.php index a25bee9e..614f5298 100755 --- a/public/frontend.php +++ b/public/frontend.php @@ -127,6 +127,10 @@ function gtm4wp_get_user_ip( $use_custom_header = '' ) { } } + if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { + return filter_var( wp_unslash( $_SERVER['REMOTE_ADDR'] ), FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ); + } + return ''; }