-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
47 lines (41 loc) · 1.04 KB
/
uninstall.php
File metadata and controls
47 lines (41 loc) · 1.04 KB
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
/**
* Endmark Plugin Uninstall
*
* @package Endmark
*/
// Prevent direct access
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
/**
* Clean up all plugin options for a single site
*/
function endmark_uninstall_cleanup() {
// Current options (v4.0+)
delete_option('endmark_settings');
delete_option('endmark_network_settings');
delete_option('endmark_presets');
delete_option('endmark_version');
// Legacy options (v3.x and earlier)
delete_option('endmark_type');
delete_option('endmark_symbol');
delete_option('endmark_image');
delete_option('endmark_where');
}
/**
* Run cleanup for multisite or single site
*/
if (is_multisite()) {
// Get all site IDs
$site_ids = get_sites(array('fields' => 'ids'));
foreach ($site_ids as $blog_id) {
switch_to_blog($blog_id);
endmark_uninstall_cleanup();
restore_current_blog();
}
// Also clean network-level options
delete_site_option('endmark_network_settings');
} else {
endmark_uninstall_cleanup();
}