-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
executable file
·52 lines (41 loc) · 1023 Bytes
/
Copy pathuninstall.php
File metadata and controls
executable file
·52 lines (41 loc) · 1023 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
46
47
48
49
50
51
52
<?php
/**
* Fired when the plugin is uninstalled.
*
* @link http://www.alexisvillegas.com
* @since 1.0.0
* @package Easy_Widget_Columns
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// If user doesn't have the right permissions, then exit.
if ( ! current_user_can( 'activate_plugins' ) ) {
return;
}
// If action didn't originate on the proper page, then exit.
if ( __FILE__ !== WP_UNINSTALL_PLUGIN ) {
return;
}
// Delete plugin options from database.
if ( is_multisite() ) {
delete_option( 'easy-widget-columns' );
if ( function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
$sites = get_sites();
if ( $sites ) {
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
delete_option( 'easy-widget-columns' );
restore_current_blog();
}
}
return;
}
} else {
delete_option( 'easy-widget-columns' );
}