IP address forwarding X-Forwarded-For

Hi There, I’m not a techie but I’m wanting to use a company called Ezoic to handle my adsense accounts. I’m using siteground and they have a captcha blocker set up that I need to forward the real IP’s through to Siteground.
this link is the The Ezoic support article that I was referred to.

Ultimately I was told to add the code below to my wp-config file:
// 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];
}

my questions are the following:

  1. should I add this to the wp-config.php file
    1a) if not, do i add this to the functions.php file in x theme?
    1b) if 1a is yes, how do i do this?
  2. is there another option?

thanks for your help

Hello There,

Thanks for writing in! It seems that you have a problem with Ezoic. We might not be able to help you because this is a 3rd party and we do not have any first hand experience in using this product. if they have instructed you to do so, then please follow them.

If you they say, add it in the wp-config.php file, then you will need to log in to your ftp using FIlezilla for example and find the wp-config.php file, edit it and insert the code they require.

I am sure if that would work in your child theme’s functions.php file as they only said to add it to the wp-config.php file.

For best solution, please contact the guys over at Ezoic to help you.

Thank you for your understanding.