• Resolved tim.samuelsson

    (@timsamuelsson)


    Hi,

    Im running a multisite setup with domainmaped subsites.

    The problem is that the plugin is using homeurl as the URL to make purge requests.

    I my case the homeurl is “mastersite.com” and i have “subsite1.com” and “subsite2.com”. In wp admin the urls is “mastersite.com/subsite1” and “mastersite.com/subsite2”.

    It works when i update posts because i added the following filter:

    add_filter('vhp_purge_urls', function ($urls, $postId) {
        $mappedDomain = domain_mapping_siteurl([]);
        $adminUrl = home_url();
    
        foreach ($urls as &$url) {
            $url = str_replace($adminUrl, $mappedDomain, $url);
        }
    
        return $urls;
    }, 10, 2);

    When I using the global button in the admin bar i endup in the function purgeUrl (Row 248).

    When that method is called on row 231 in executePurge its looks like this:
    $this->purgeUrl( home_url() .'/?vhp-regex' );

    My problem is that the home_url is mastersite.com/subsite1 and not subsite1.com.

    Im using this plugin for domain mapping: https://sv.ww.wp.xz.cn/plugins/wordpress-mu-domain-mapping/

    Would it be possible for you to fixe the plugin so it works when i use multisite with domainmapping?

    You can use the function domain_mapping_siteurl([]) to get the domainmapped site_url.

    Many thanks

    //Tim Cifuentes Vargas

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    The home_url() should be the DISPLAYED URL of your site.

    So home_url should be subsite1.com and site_url should be mastersite.com/subsite1…

    I thought that plugin actually did a filter on home_url() across the board so it always returned the value of what should display on the front end, but I guess not. Huh.

    Really the right fix would be to have a filter change all instances of home_url() to it’s mapped domain, since a lot of other themes and plugins rely on that, and you’ll get inconsistent URLs otherwise.

    Meantime, I can make that filterable, though I have to see if that has any unintended consequences.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    FYI a filter for this will be included in v 4.0. It’s waiting on some WP-CLI fixes before I can push it out.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Multisite problems’ is closed to new replies.