-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
42 lines (35 loc) · 943 Bytes
/
uninstall.php
File metadata and controls
42 lines (35 loc) · 943 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 Image Optimizer PRO
* Plugin uninstall routine
*
* @package ImageOptimizerPro
*/
// phpcs:disable WordPress.WhiteSpace.PrecisionAlignment.Found
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
require_once 'plugin.php';
if ( is_multisite() ) {
$sites = get_sites();
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
image_optimizer_pro_uninstall_site();
restore_current_blog();
}
} else {
image_optimizer_pro_uninstall_site();
}
/**
* Uninstall Image Optimizer PRO
*
* @since 1.0
*/
function image_optimizer_pro_uninstall_site() {
// remove license key
delete_option( \ImageOptimizerPro\Constants\LICENSE_KEY_OPTION );
delete_site_option( \ImageOptimizerPro\Constants\LICENSE_KEY_OPTION );
// delete license transient
delete_transient( \ImageOptimizerPro\Constants\LICENSE_INFO_TRANSIENT );
delete_site_transient( \ImageOptimizerPro\Constants\LICENSE_INFO_TRANSIENT );
}