fapi-member
Last commit date
_sources
7 months ago
app
7 months ago
languages
7 months ago
libs
7 months ago
media
7 months ago
multiple-blocks
7 months ago
src
7 months ago
vendor
7 months ago
fapi-member.php
7 months ago
readme.txt
7 months ago
uninstall.php
7 months ago
uninstall.php
43 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FapiMemberOld; |
| 4 | |
| 5 | // if uninstall.php is not called by WordPress, die |
| 6 | use FapiMember\Model\Enums\Keys\MetaKey; |
| 7 | use FapiMember\Model\Enums\Keys\OptionKey; |
| 8 | |
| 9 | if (!defined('WP_UNINSTALL_PLUGIN')) { |
| 10 | die; |
| 11 | } |
| 12 | |
| 13 | require __DIR__ . '/fapi-member.php'; |
| 14 | |
| 15 | $options = [ |
| 16 | OptionKey::API_CHECKED, |
| 17 | OptionKey::SETTINGS, |
| 18 | OptionKey::API_USER, |
| 19 | OptionKey::API_KEY, |
| 20 | OptionKey::API_CREDENTIALS, |
| 21 | ]; |
| 22 | |
| 23 | foreach ($options as $o) { |
| 24 | delete_option($o); |
| 25 | } |
| 26 | |
| 27 | // unregistering taxonomy does not remote its terms and their meta |
| 28 | $terms = get_terms(['taxonomy' => 'fapi_levels', 'hide_empty' => false,]); |
| 29 | foreach ($terms as $term) { |
| 30 | wp_delete_term($term->term_id, 'fapi_levels'); |
| 31 | } |
| 32 | unregister_taxonomy('fapi_levels'); |
| 33 | |
| 34 | $users = get_users(); |
| 35 | $metaKeys = [ |
| 36 | MetaKey::MEMBERSHIP, |
| 37 | MetaKey::MEMBERSHIP_HISTORY, |
| 38 | ]; |
| 39 | |
| 40 | foreach ($metaKeys as $k) { |
| 41 | delete_metadata('user', 0, $k, '', true); |
| 42 | } |
| 43 |