WP Flush Cache via Code Snippet possible?


im trying to Flush the WP Cache on my Child Sites via the Code Snippet Extension.

I tried already with a dev site to send the following snippet:

function wp_cache_flush() {

global $wp_object_cache ;

return $wp_object_cache -> flush ();


Site is connected, as i can update plugins and themes.

When send the Snippet to the Child Site i get “Process completed successfully” back, but also the Message:" MainWP Child plugin not detected. First, install and activate the plugin and add your site to your MainWP Dashboard afterward"

Some Ideas ?
Best regards

Hi Sallida,

thanks for reaching out.
Do you get this error for any code snippet or just this one?
What snippet type do you have selected when running this snippet?

Hello Bogdan,

thanks for your reply. If I choose an example snippet and load it I get no error message.

With my Snippet, I have Snippet Type Return Info from Child Sites marked.

best regards

Hi Sallida,

thanks for verifying that. It seems that the problem is in the snippet itself.

I am not a coder so I am not 100% sure, but I think that the problem is that in your snippet, function is coded, but there is no actual call to the function, so it’s not being executed.

Please allow me a bit to verify this with out dev team.

Hi Sallida,

I just got back from the dev tam.

They say that it should be enough to have the code snippet just as this:


Running the snippet as in your example causes the double function error.

Hello Bogdan,

thanks for the reply. When running the snippet as you mentioned it works fine without any error.

Thanks a Lot!
best regards

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.