-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
43 lines (38 loc) · 921 Bytes
/
Copy pathuninstall.php
File metadata and controls
43 lines (38 loc) · 921 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
<?php
/**
* Fired when the plugin is uninstalled.
*
* Removes plugin options and per-post metadata so no orphaned data is
* left behind. Runs for every site on multisite installs.
*
* @since 2.0.0
* @package Auto_Refresh_Post_Page
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
/**
* Delete all plugin data for the current site.
*
* @return void
*/
function arpp_uninstall_site() {
delete_option( 'ARPP_settings' );
delete_option( 'ARPP_my_option_name' );
delete_option( 'ARPP_version' );
delete_post_meta_by_key( '_arpp_post_settings' );
delete_post_meta_by_key( 'ARPP_duration_options' );
}
if ( is_multisite() ) {
$arpp_site_ids = get_sites( array( 'fields' => 'ids' ) );
foreach ( $arpp_site_ids as $arpp_site_id ) {
switch_to_blog( $arpp_site_id );
arpp_uninstall_site();
restore_current_blog();
}
} else {
arpp_uninstall_site();
}