Skip to content

Instantly share code, notes, and snippets.

@sabrina-zeidan
Last active April 18, 2020 18:19
Wrapper for bulk actions in WP MU install [Wordpress]
if ( is_multisite()) {
$sites = get_sites();
foreach ($sites as $site ) {
$blog_id = $site->blog_id;
//if ($blog_id < 6 ){ //if we need just certain blogs
switch_to_blog( $blog_id );
wp_suspend_cache_addition(true);
//here's what we're gonna do...
wp_suspend_cache_addition(false);
restore_current_blog();
//} //endif $blog_id
sleep(3); // this should be paused for 3 seconds before every other blog
}//endforeach
}//endif multisite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment