• Hi.

    I have a cronjob which runs every 10 minutes.
    We have a WordPress multisite installation with 2 sites (on separate domains) in the multisite network.
    We are creating/updating/deleting WP Job Manager posts with this php cron script.
    And everything is cached with WP Fastest Cache.

    So here is my problem:
    I am calling the cronjob on Site1 (example.hu/do-cron.php), and this script manipulates data on both multisite websites.
    I am switching between WP multisite with the standard switch_to_blog() function provided by WP.

    When everything is done, I want to delete the WPFC cache for both sites. I use the following functions to do so:
    wpfc_clear_all_cache();
    wpfc_clear_all_cache(true);

    However if you look inside the getWpContentDir() WPFC function’s code (which is used by the previously mentioned function), you can see it determines the current website’s domain name from $_SERVER[‘HTTP_HOST’] – instead of using the standard get_site_url() WordPress function.
    The difference here is that standard WP function handles multisite’s switch_to_blog() functions, while the $_SERVER variable obviously doesn’t.

    In this case because I called the cronjob from Site1, it only deletes cache for Site1, even if I switch to Site2 via the switch_to_blog() function because it gets the site url from the server variable.

    Edit: this feature is implemented for WPML in the getWpContentDir() function. The same would be the intended behavior for multisite websites.

    Could you please fix this issue?

    Thanks a lot,
    Balazs

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multisite delete cache problem’ is closed to new replies.