forked from WebberZone/crp-taxonomy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
47 lines (35 loc) · 1.01 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
<?php
/**
* Fired when the plugin is uninstalled
*
* @package CRP_Taxonomy
* @author Ajay D'Souza <[email protected]>
* @license GPL-2.0+
* @link http://ajaydsouza.com
* @copyright 2014 Ajay D'Souza
*/
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();
}
global $wpdb, $crp_settings;
$option_name = 'ald_crp_settings';
if ( !is_multisite() ) {
unset( $crp_settings['crpt_tag'] );
unset( $crp_settings['crpt_category'] );
update_option( $option_name, $crp_settings );
} else {
// Get all blogs in the network and activate plugin on each one
$blog_ids = $wpdb->get_col( "
SELECT blog_id FROM $wpdb->blogs
WHERE archived = '0' AND spam = '0' AND deleted = '0'
" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
unset( $crp_settings['crpt_tag'] );
unset( $crp_settings['crpt_category'] );
update_option( $option_name, $crp_settings );
}
// Switch back to the current blog
restore_current_blog();
}
?>