Skip to content

Instantly share code, notes, and snippets.

@sabrina-zeidan
Last active April 18, 2020 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sabrina-zeidan/8cee56b43a6b6ab5c61ad53da2bf276d to your computer and use it in GitHub Desktop.
Save sabrina-zeidan/8cee56b43a6b6ab5c61ad53da2bf276d to your computer and use it in GitHub Desktop.
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