Clear the cache of a particular site in multisite
-
Hello,
There is a problem clearing the cache for a site that uses a different domain.
See the following configuration example:
site 1 home: https://www.example.com
site 2 home: https://www.example.com/testsite
site 3 home: https://123.example.com$sites = get_sites();
foreach ($sites as $site) {
switch_to_blog($site->blog_id);global $file_prefix;
wp_cache_clean_cache($file_prefix);restore_current_blog();
}For it to work I have to do the following:
$sites = get_sites();
foreach ($sites as $site) {
switch_to_blog($site->blog_id);global $file_prefix, $supercachedir;
$supercachedir=get_supercache_dir(get_current_blog_id());
wp_cache_clean_cache($file_prefix);restore_current_blog();
}I intend to clear a particular site’s cache if necessary.
- The topic ‘Clear the cache of a particular site in multisite’ is closed to new replies.