Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Deactivate plugins on each site in multisite. Drop in wordpress root directory. Assumes wp-config.php is in same directory. Props @kovshenin for the concept
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
require( 'wp-config.php' );
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
global $wpdb;
$blogs = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs;" );
foreach ( $blogs as $id ) {
switch_to_blog( $id );
deactivate_plugins( array( 'plugin-folder/plugin-file.php' ) );
printf( 'Processed blog ID: ' . $id );
printf( 'Processed all blogs' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.