wps-hide-login
Last commit date
classes
3 years ago
languages
3 years ago
vendor
3 years ago
autoload.php
3 years ago
composer.json
3 years ago
composer.lock
3 years ago
readme.txt
3 years ago
uninstall.php
3 years ago
wps-hide-login.php
3 years ago
uninstall.php
50 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Fired when the plugin is uninstalled. |
| 4 | * |
| 5 | * @package WPS Hide Login |
| 6 | * @author Remy Perona <remperona@gmail.com> |
| 7 | * @license GPL-2.0+ |
| 8 | * @link http://remyperona.fr |
| 9 | * @copyright 2015 Remy Perona |
| 10 | */ |
| 11 | |
| 12 | // If uninstall not called from WordPress, then exit |
| 13 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | global $wpdb; |
| 18 | |
| 19 | if ( is_multisite() ) { |
| 20 | |
| 21 | $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A ); |
| 22 | delete_site_option( 'whl_page' ); |
| 23 | delete_site_option( 'whl_redirect_admin' ); |
| 24 | |
| 25 | flush_rewrite_rules(); |
| 26 | |
| 27 | if ( $blogs ) { |
| 28 | |
| 29 | foreach ( $blogs as $blog ) { |
| 30 | switch_to_blog( $blog['blog_id'] ); |
| 31 | delete_option( 'whl_page' ); |
| 32 | delete_option( 'whl_redirect_admin' ); |
| 33 | |
| 34 | flush_rewrite_rules(); |
| 35 | |
| 36 | //info: optimize table |
| 37 | $GLOBALS['wpdb']->query( "OPTIMIZE TABLE `" . $GLOBALS['wpdb']->prefix . "options`" ); |
| 38 | restore_current_blog(); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | } else { |
| 43 | delete_option( 'whl_page' ); |
| 44 | delete_option( 'whl_redirect_admin' ); |
| 45 | |
| 46 | flush_rewrite_rules(); |
| 47 | |
| 48 | //info: optimize table |
| 49 | $GLOBALS['wpdb']->query( "OPTIMIZE TABLE `" . $GLOBALS['wpdb']->prefix . "options`" ); |
| 50 | } |