-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuninstall.php
More file actions
42 lines (33 loc) · 865 Bytes
/
uninstall.php
File metadata and controls
42 lines (33 loc) · 865 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
namespace FapiMemberOld;
// if uninstall.php is not called by WordPress, die
use FapiMember\Model\Enums\Keys\MetaKey;
use FapiMember\Model\Enums\Keys\OptionKey;
if (!defined('WP_UNINSTALL_PLUGIN')) {
die;
}
require __DIR__ . '/fapi-member.php';
$options = [
OptionKey::API_CHECKED,
OptionKey::SETTINGS,
OptionKey::API_USER,
OptionKey::API_KEY,
OptionKey::API_CREDENTIALS,
];
foreach ($options as $o) {
delete_option($o);
}
// unregistering taxonomy does not remote its terms and their meta
$terms = get_terms(['taxonomy' => 'fapi_levels', 'hide_empty' => false,]);
foreach ($terms as $term) {
wp_delete_term($term->term_id, 'fapi_levels');
}
unregister_taxonomy('fapi_levels');
$users = get_users();
$metaKeys = [
MetaKey::MEMBERSHIP,
MetaKey::MEMBERSHIP_HISTORY,
];
foreach ($metaKeys as $k) {
delete_metadata('user', 0, $k, '', true);
}