-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
42 lines (37 loc) · 937 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
37
38
39
40
41
42
<?php
/**
* Plugin uninstaller logic.
*
* @package performance-lab
* @since 1.2.0
*/
// If uninstall.php is not called by WordPress, bail.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// For a multisite, delete the option for all sites (however limited to 100 sites to avoid memory limit or timeout problems in large scale networks).
if ( is_multisite() ) {
$site_ids = get_sites(
array(
'fields' => 'ids',
'number' => 100,
'update_site_cache' => false,
'update_site_meta_cache' => false,
)
);
foreach ( $site_ids as $site_id ) {
switch_to_blog( $site_id );
perflab_delete_plugin_option();
restore_current_blog();
}
}
perflab_delete_plugin_option();
/**
* Delete the current site's option.
*
* @since 1.4.0
*/
function perflab_delete_plugin_option() {
delete_option( 'perflab_modules_settings' );
delete_option( 'perflab_generate_webp_and_jpeg' );
}