-
Notifications
You must be signed in to change notification settings - Fork 381
/
uninstall.php
35 lines (30 loc) · 744 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
<?php
/**
* Plugin uninstall file.
*
* @package AMP
*/
namespace AmpProject\AmpWP;
// If uninstall.php is not called by WordPress, then die.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
die;
}
require_once dirname( __FILE__ ) . '/includes/uninstall-functions.php';
if ( is_multisite() && ! wp_is_large_network() ) {
$site_ids = get_sites(
[
'fields' => 'ids',
'number' => '',
'update_site_cache' => false,
'update_site_meta_cache' => false,
]
);
$site_ids = ( ! empty( $site_ids ) && is_array( $site_ids ) ) ? $site_ids : [];
foreach ( $site_ids as $site_id ) {
switch_to_blog( $site_id );
remove_plugin_data();
}
restore_current_blog();
} else {
remove_plugin_data();
}