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