• Hi there,

    I have a multisite installation and I am trying to access the other blogs (3 others) to flush the page cache and it doesn’t seem to be working.

    I have the following code below (not my actual code but the idea of what I am trying to do)…

    global $wpdb;
    $current_blog_id = get_current_blog_id();
    $blogs = $wpdb->get_col("Select blog_id From {$wpdb->blogs}");
    foreach($blogs as $blog_id) {
    	if($current_blog_id != $blog_id)
    		switch_to_blog($blog_id);
    
    	$front_page = get_option("page_on_front");
    	$result = w3tc_pgcache_flush_post($front_page);
            var_dump($result); // displays bool(true)
    
    	if($current_blog_id != $blog_id)
    		restore_current_blog();
    }

    Would someone be able to shed some light please as to what I might be doing wrong?

    https://www.ads-software.com/extend/plugins/w3-total-cache/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Nathan Franklin

    (@nathanfranklinau)

    From what I can see this is a bug in W3 Total Cache.

    Without delving too much into the code, I can see that in the W3_PgCache class in function _get_cache there is a static declaration to store the $cache object.

    If _get_cahce is called when the current blog is 1, the cache object is set for that particular blog. If I then call switch_to_blog(2) and call _get_cache() the object will return the cache for the blog with the id of 1 rather than 2.

    Could you confirm this is a a bug?

    we’re all getting problems with W3TC and no one’s responding.

    So far GoDaddy, InMotion Hosting and Liquid Web are all telling customers to fully uninstall W3TC and install WP Super Cache since there doesn’t seem to be any response to this issue that’s affecting a lot of sites.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multisite flush page cache on another blog’ is closed to new replies.