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://wordpress.org/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: edward@plainviewplugins.com) 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 5 years, 4 months ago by
qtwrk.