forked from Codeinwp/wp-maintenance-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
executable file
·36 lines (31 loc) · 873 Bytes
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
// If uninstall not called from WordPress, then exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit();
}
/**
* Uninstall operations
*/
function single_uninstall() {
// delete subscribers table
$GLOBALS['wpdb']->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}wpmm_subscribers");
// delete options
delete_option('wpmm_settings');
delete_option('wpmm_notice');
delete_option('wpmm_version');
}
// Let's do it!
if (is_multisite()) {
single_uninstall();
// delete data foreach blog
$blogs_list = $GLOBALS['wpdb']->get_results("SELECT blog_id FROM {$GLOBALS['wpdb']->blogs}", ARRAY_A);
if (!empty($blogs_list)) {
foreach ($blogs_list as $blog) {
switch_to_blog($blog['blog_id']);
single_uninstall();
restore_current_blog();
}
}
} else {
single_uninstall();
}