forked from wp-plugins/recent-posts-widget-with-thumbnails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
42 lines (36 loc) · 949 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
<?php
/**
* Fired when the plugin is uninstalled.
*
* @package Purify_WordPress_Menus
* @author Martin Stehle <[email protected]>
* @license GPL-2.0+
* @link http://wordpress.org/plugins/purify-wp-menues/
* @copyright 2014
*/
// If uninstall not called from WordPress, then exit
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
/**
* Delete options from the database while deleting the plugin files
* Run before deleting the plugin
*
* @since 2.0
*/
// remove settings
if ( is_multisite() ) {
$sites = wp_get_sites();
if ( empty ( $sites ) ) return;
foreach ( $sites as $site ) {
// switch to next blog
switch_to_blog( $site[ 'blog_id' ] );
// remove settings
delete_option( 'widget_recent-posts-widget-with-thumbnails' );
}
// restore the current blog, after calling switch_to_blog()
restore_current_blog();
} else {
// remove settings
delete_option( 'widget_recent-posts-widget-with-thumbnails' );
}