• Resolved Ced

    (@cedriccharles)


    Hello there ??

    I have a WordPress Multisite that contains 1 primary site and 10+ sub-sites. The content of the sub-sites directly depends on the primary site. My client only create contents on the primary site, than the content is dispatched (with Three WP Broadcast plugin: https://www.ads-software.com/plugins/threewp-broadcast/)

    When my client create a post on the primary site, the LiteSpeed cache is cleared on the primary site, but not on the sub-sites. So the new post is not showing on the multiple sub-sites. I would like to have a button in the admin bar next to the current Litespeed button (or a new item in the current button) which allow my client to “Clear all sites/sub-sites cache”.

    How can I achieve that?

    Thank you in advance,
    Cedric

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support usabe

    (@usabe)

    Hi, Cedric,

    I just did a forum search, and found that actually you proposed this question a while ago. Please refer to this post: https://www.ads-software.com/support/topic/purging-all-cache-for-whole-multisite-network/

    To achieve what you want, I guess you can make the button just to implement the second solution provided in the post above.

    second solution , create a PHP file with code
    <?php
    header(‘x-litespeed-purge: *’);
    access it will result purge all as well.

    Best regards

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    actually if you purge it at network admin page, it purges for all subsites

    Best regards,

    Thread Starter Ced

    (@cedriccharles)

    Hi there ?? !

    Thank you for your answers.
    @qtwrk @usabe unfortunately, my client doesn’t access the network admin page. He has only access to the primary site admin page and wants to be able to clear all the cache by himself. I guess if that button exists on the network admin page, I can “copy” the code to put it on the primary site admin page ?? ? Can you tell me how or where this code is located in your plugin?

    Thank you in advance,
    Cedric

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    simplest way would be what usabe suggested

    create a PHP file with content

    <?php
    header('x-litespeed-purge:*');

    then access it

    of course you can put some further verification over it , like check against IP or something.

    if you want to do it within WP

    try this code

    <?php 
    define( 'WP_USE_THEMES', true );
    require( './wp-load.php' );
    
     if (defined('LSCWP_V'))
    {
            define( 'LSWCP_EMPTYCACHE', true);
            do_action( 'litespeed_purge_all' );
    }

    Best regards,

    Thread Starter Ced

    (@cedriccharles)

    Hi and thanks.
    Can’t this be done exactly like what you do for the network link in the admin bar?

    Kind regards,
    Cedric

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    yes

    you can add this

    define( 'LSWCP_EMPTYCACHE', true);

    to wp-config.php

    then a purge all from any of sub-site will cause purge all on entire network

    Best regards,

    Thread Starter Ced

    (@cedriccharles)

    Hello ??

    Oh ok, simply adding define( 'LSWCP_EMPTYCACHE', true); in wp-config.php will purge all caches everytime “Purge all” is hit, whatever site it’s hit?

    Kind regards

    Plugin Support qtwrk

    (@qtwrk)

    yes

    it should be purge all on entire network from any of sites

    Thread Starter Ced

    (@cedriccharles)

    Perfect ?? Thank you! (what a fast answer :p)

    Thread Starter Ced

    (@cedriccharles)

    One more question: the “Three WP Broadcast” plugin uses a “Queue” system to send posts created in one sub-site to another sub-site. Sometimes, I have 50 posts that should be broadcasted, so I have 50 posts in the queue. When they are all broadcasted, the plugin needs to empty all the caches.

    The plugin developer (Edward, Plainview Plugins: [email protected]) told me he can launch some code when the queue is fully processed, but require me to tell him the code he should trigger. Could you please help with this?

    Kind regards,
    Cedric

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    please kindly tell him following :

    if (defined('LSCWP_V')) {
    
    define( 'LSWCP_EMPTYCACHE', true);
    do_action( 'litespeed_purge_all' );
    # above 2 lines to purge entire network
    
    do_action( 'litespeed_purge_post', $post_id );
    #or post a specific page by post_id
    
    }

    more detail here

    Best regards,

    • This reply was modified 3 years, 9 months ago by qtwrk.
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Force multisite clear cache’ is closed to new replies.