Skip to content

Commit

Permalink
gtm4wp_get_user_ip() did not return REMOTE_ADDR by default
Browse files Browse the repository at this point in the history
  • Loading branch information
duracelltomi committed Jan 24, 2024
1 parent 090b4e7 commit c960f21
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions public/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
}

Expand Down

0 comments on commit c960f21

Please sign in to comment.