-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstaller.php
31 lines (24 loc) · 998 Bytes
/
uninstaller.php
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
<?php
// If uninstall is not called from WordPress, exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
// Delete the plugin options from the database
delete_option('wp_feature_remover_options');
// If you have any custom tables, you can drop them here
// global $wpdb;
// $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}your_custom_table");
// If you've added any roles or capabilities, remove them
// remove_role('your_custom_role');
// $role = get_role('administrator');
// $role->remove_cap('your_custom_capability');
// Clear any cached data that may have been stored
wp_cache_flush();
// If you've scheduled any cron jobs, clear them
// wp_clear_scheduled_hook('your_cron_hook');
// If you've registered any post types or taxonomies, you might want to clear posts
// $posts = get_posts(array('post_type' => 'your_custom_post_type', 'numberposts' => -1));
// foreach ($posts as $post) {
// wp_delete_post($post->ID, true);
// }
// You can add any other cleanup operations here