• Resolved Kim

    (@kimikaze)


    There is an issue with the plugin that will result in it not working on some sites. The issue showed up on a multisite network where each site has different domains. Specifically the issue seems to be the get_current_url() method and the usage of $_SERVER['SERVER_NAME']. $_SERVER['SERVER_NAME'] is in this case the main multisite site domain, and not the current site domain. Changing $_SERVER['SERVER_NAME'] to $_SERVER['HTTP_HOST'] solves the issue in this case. Is this something that can be fixed in a new version?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author kubiq

    (@kubiq)

    Hello, I’ve just tested this on 3 different multisite websites on 3 different hostings and I can not reproduce this issue.

    Are you sure your server is configured properly?
    Is it some custom server or it is configured by professionals from some well-known providers?

    $_SERVER['SERVER_NAME'] is set in the server configuration and is generally more reliable, than $_SERVER['HTTP_HOST'] that is just a?header from the current request provided by the client and can be manipulated. There are many cases when there is no HTTP_HOST

    Thread Starter Kim

    (@kimikaze)

    This was on a multisite hosted on Kinsta.

    Plugin Author kubiq

    (@kubiq)

    Well, I can not replace this in my plugin, but I can create a filter hook, that you can use eg. in your functions.php to modify the output from get_current_url function.

    If this is still relevant for you, then let me know and I’ll add this apply_filter in there ??

    I’m not the original poster, but I’m having the same issue. An apply_filter would be useful, or even a ternary like below would likely fix for these instances:

    $domain_name = $_SERVER['SERVER_NAME'] !== 'localhost' ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];

    $real_url .= $domain_name . $REQUEST_URI;

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