-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
56 lines (46 loc) · 1.52 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* Fired when the plugin is uninstalled.
*
* Everything in uninstall.php will be executed when user decides to delete the plugin.
*
* @since 1.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
// If uninstall not called from WordPress, then die.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) die;
/**
* Delete database settings
*
* @since 1.0
* @since 1.7 Added clean-up for superpwa_active_addons and superpwa_utm_tracking_settings
*/
delete_option( 'superpwa_settings' );
delete_option( 'superpwa_active_addons' );
delete_option( 'superpwa_utm_tracking_settings' );
delete_option( 'superpwa_version' );
/**
* Clean up for Multisites
*
* @since 1.6
* @since 1.7 Added clean-up for superpwa_active_addons and superpwa_utm_tracking_settings
*/
if ( is_multisite() ) {
// Retrieve the list of blog ids where SuperPWA is active. (saved with blog_id as $key and activation_status as $value)
$superpwa_sites = get_site_option( 'superpwa_active_sites' );
// Loop through each active site.
foreach( $superpwa_sites as $blog_id => $actviation_status ) {
// Switch to each blog
switch_to_blog( $blog_id );
// Delete database settings for each site.
delete_option( 'superpwa_settings' );
delete_option( 'superpwa_active_addons' );
delete_option( 'superpwa_utm_tracking_settings' );
delete_option( 'superpwa_version' );
// Return to main site
restore_current_blog();
}
// Delete the list of websites where SuperPWA was activated.
delete_site_option( 'superpwa_active_sites' );
}