Last active
April 18, 2020 18:19
-
-
Save sabrina-zeidan/8cee56b43a6b6ab5c61ad53da2bf276d to your computer and use it in GitHub Desktop.
Wrapper for bulk actions in WP MU install [Wordpress]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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