-
-
Save bogdanmoisin/c81ae371a8f3f963c1957f1b05a74168 to your computer and use it in GitHub Desktop.
WordPress Config: Use X-Forwarded-For HTTP Header to Get Visitor's Real IP Address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use X-Forwarded-For HTTP Header to Get Visitor's Real IP Address | |
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { | |
$http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ); | |
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment