Skip to content

Instantly share code, notes, and snippets.

@sheabunge
Created January 13, 2013 05:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheabunge/4522405 to your computer and use it in GitHub Desktop.
Save sheabunge/4522405 to your computer and use it in GitHub Desktop.
WordPress multisite plugin uninstall
<?php
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
exit();
if ( is_multisite() ) {
$blogs = $wpdb->get_results( "SELECT blog_id FROM $wpdb->blogs", ARRAY_A );
if ( $blogs ) {
foreach ( $blogs as $blog ) {
switch_to_blog( $blog['blog_id'] );
delete_option( 'plugin_option_name' );
}
restore_current_blog();
}
} else {
delete_option( 'plugin_option_name' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment