[Support request] How to add wp_config file in child theme

Home Forums Support How to add wp_config file in child theme

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1322919
    Garrick

    Hi,

    Here’s a quick background to give context to my question.

    I recently moved my site to Kinsta, with the DNS pointed to Cloudfare and monetizing it with Ezoic.

    Ezoic recently sent me a message that I needed to “Set up an X-Forwarded-For Header”.

    One of the options listed here (https://support.ezoic.com/en/support/solutions/articles/48000453992-using-the-x-forwarded-for-xff-header) is to add this code in the wp_config file of the WordPress theme.

    // 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];
    
    }

    Which brings me to the question, how do I add a wp_config file on the child theme?

    I asked Ezoic if I could add the code instead to the main wp_config file in the root directory, they told me to ask the theme developer “if the theme is linked to the main wp-config file”.

    So it’s two questions.

    1. Can I add a wp_config file within the child theme?

    2. WOuld it be possible to add the code in the main wp_config file if the first option isn’t possible?

    #1322968
    Leo
    Staff
    Customer Support

    Hi there,

    I don’t think this is related to the theme.

    Can you ask them how to get it done if you are using a default twenty series WP theme?

    Then just try applying the exact same steps with GP and see if that works.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.