-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.php
More file actions
42 lines (36 loc) · 831 Bytes
/
Copy pathuninstall.php
File metadata and controls
42 lines (36 loc) · 831 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
<?php
/**
* Uninstall Tour Operator.
*
* Runs when the plugin is deleted from the WordPress admin. Removes the plugin's
* persisted (and autoloaded) options so nothing is orphaned in the database.
*
* @package tour-operator
*/
// Only run as a genuine WordPress uninstall request.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
$lsx_to_options = array(
'lsx_to_settings',
'lsx_to_slugs',
);
if ( ! is_multisite() ) {
foreach ( $lsx_to_options as $lsx_to_option ) {
delete_option( $lsx_to_option );
}
} else {
$lsx_to_site_ids = get_sites(
array(
'fields' => 'ids',
'number' => 0,
)
);
foreach ( $lsx_to_site_ids as $lsx_to_site_id ) {
switch_to_blog( $lsx_to_site_id );
foreach ( $lsx_to_options as $lsx_to_option ) {
delete_option( $lsx_to_option );
}
restore_current_blog();
}
}