fapi-member
Last commit date
_sources
2 years ago
languages
2 years ago
media
2 years ago
multiple-blocks
2 years ago
src
2 years ago
templates
2 years ago
vendor
2 years ago
fapi-member.php
2 years ago
readme.txt
2 years ago
uninstall.php
2 years ago
uninstall.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FapiMember; |
| 4 | |
| 5 | // if uninstall.php is not called by WordPress, die |
| 6 | if (!defined('WP_UNINSTALL_PLUGIN')) { |
| 7 | die; |
| 8 | } |
| 9 | |
| 10 | require __DIR__ . '/fapi-member.php'; |
| 11 | |
| 12 | $options = [ |
| 13 | FapiMemberPlugin::OPTION_KEY_API_CHECKED, |
| 14 | FapiMemberPlugin::OPTION_KEY_SETTINGS, |
| 15 | FapiMemberPlugin::OPTION_KEY_API_USER, |
| 16 | FapiMemberPlugin::OPTION_KEY_API_KEY, |
| 17 | FapiMemberPlugin::OPTION_KEY_API_CREDENTIALS |
| 18 | ]; |
| 19 | |
| 20 | foreach ($options as $o) { |
| 21 | delete_option($o); |
| 22 | } |
| 23 | |
| 24 | // unregistering taxonomy does not remote its terms and their meta |
| 25 | $terms = get_terms(['taxonomy' => FapiLevels::TAXONOMY, 'hide_empty' => false,]); |
| 26 | foreach ($terms as $term) { |
| 27 | wp_delete_term($term->term_id, FapiLevels::TAXONOMY); |
| 28 | } |
| 29 | unregister_taxonomy(FapiLevels::TAXONOMY); |
| 30 | |
| 31 | $users = get_users(); |
| 32 | $metaKeys = [ |
| 33 | FapiMembershipLoader::MEMBERSHIP_META_KEY, |
| 34 | FapiMembershipLoader::MEMBERSHIP_HISTORY_META_KEY, |
| 35 | ]; |
| 36 | |
| 37 | foreach ($metaKeys as $k) { |
| 38 | delete_metadata('user', 0, $k, '', true); |
| 39 | } |
| 40 |