Created
January 13, 2013 05:03
-
-
Save sheabunge/4522405 to your computer and use it in GitHub Desktop.
WordPress multisite plugin uninstall
This file contains hidden or 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
<?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