-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
43 lines (32 loc) · 942 Bytes
/
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
<?php
/*
Removes: Options, Demo Post Type, Piklist Tables
*/
if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN'))
{
exit;
}
global $wpdb;
delete_option('piklist'); // TODO: check for add-ons from other plugins.
delete_option('piklist_demo_fields');
delete_option('piklist_active_plugin_versions');
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '%_pik_%';");
// Delete all Demo posts
$demos = get_posts(array(
'numberposts' => -1
,'post_type' =>'piklist_demo'
,'post_status' => 'all'
));
if ($demos)
{
foreach ($demos as $post)
{
wp_delete_post($post->ID, true);
}
}
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->base_prefix}post_relationships");
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->base_prefix}termmeta");
// Pre-0.6.7
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->base_prefix}piklist_cpt_relate");
/** Sorry to see you go! **/
?>