forked from FoxyCart/foxyshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
executable file
·54 lines (43 loc) · 1.5 KB
/
uninstall.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
//Exit if not called in proper context
if(!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN')) exit();
//Delete Settings
delete_option('foxyshop_settings');
delete_option('foxyshop_category_sort');
delete_option('foxyshop_categories_children');
delete_option('foxyshop_rewrite_rules');
delete_option('foxyshop_setup_required');
delete_option('foxyshop_saved_variations');
delete_option('foxyshop_downloadables');
delete_option('widget_foxyshop-cart-link-widget');
delete_option('widget_foxyshop-category-list-widget');
delete_option('widget_foxyshop-category-widget');
//Put All Products in Trash
$products = get_posts(array('post_type' => 'foxyshop_product', 'numberposts' => -1, 'post_status' => null));
foreach ($products as $product) {
wp_trash_post($product->ID);
}
//Deletes All Prodcut Categories
global $wp_taxonomies;
register_taxonomy('foxyshop_categories', 'foxyshop_product');
$terms = get_terms("foxyshop_categories");
$count = count($terms);
if ($count > 0) {
foreach ( $terms as $term ) {
print_r($term);
wp_delete_term($term->term_id, 'foxyshop_categories');
}
}
unset($wp_taxonomies['foxyshop_categories']);
//Deletes All Product Tags
register_taxonomy('foxyshop_tags', 'foxyshop_product');
$terms = get_terms("foxyshop_tags");
$count = count($terms);
if ($count > 0) {
foreach ( $terms as $term ) {
wp_delete_term($term->term_id, 'foxyshop_tags');
}
}
unset($wp_taxonomies['foxyshop_tags']);
//Flush Rewrute Rules
flush_rewrite_rules();