-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuninstall.php
More file actions
45 lines (40 loc) · 984 Bytes
/
uninstall.php
File metadata and controls
45 lines (40 loc) · 984 Bytes
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
37
38
39
40
41
42
43
44
45
<?php
/**
* Uninstall Module Control for Jetpack
*
* @package JMC
*/
// Exit if uninstall not called from WordPress.
defined( 'WP_UNINSTALL_PLUGIN' ) || exit();
$default_options = array(
'jetpack_mc_manual_control',
'jetpack_mc_development_mode',
'jetpack_mc_blacklist',
);
if ( is_multisite() ) {
// Get sites in the network.
$args = array(
'fields' => 'ids',
'number' => 1000, // Limit to 1000 sites.
'update_site_meta_cache' => false,
);
$blogs = get_sites( $args );
foreach ( $blogs as $_id ) {
switch_to_blog( $_id );
// Remove site options.
foreach ( $default_options as $option ) {
delete_option( $option );
}
restore_current_blog();
}
// Remove network options.
foreach ( $default_options as $option ) {
delete_site_option( $option );
}
delete_site_option( 'jetpack_mc_subsite_override' );
} else {
// Remove site options.
foreach ( $default_options as $option ) {
delete_option( $option );
}
}