-
Notifications
You must be signed in to change notification settings - Fork 10
/
uninstall.php
55 lines (43 loc) · 1.29 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
55
<?php
/**
* Uninstall HollerBox
*
* Deletes all the plugin data i.e.
* 1. Custom Post types.
* 2. Terms & Taxonomies.
* 3. Plugin pages.
* 4. Plugin options.
* 5. Capabilities.
* 6. Roles.
* 7. Database tables.
* 8. Cron events.
*
* @since 1.4.3
* @subpackage Uninstall
* @copyright Copyright (c) 2015, Pippin Williamson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @package WPGH
*/
// Exit if accessed directly.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Load our main plugin file
include_once __DIR__ . '/holler-box.php';
Holler_Box::instance();
global $wpdb;
if ( \Holler_Settings::instance()->get( 'delete_all_data' ) ) {
\Holler_Reporting::instance()->drop();
// Delete all the posts
$wpdb->query( "DELETE p,tr,pm
FROM $wpdb->posts p
LEFT JOIN $wpdb->term_relationships tr
ON (p.ID = tr.object_id)
LEFT JOIN $wpdb->postmeta pm
ON (p.ID = pm.post_id)
WHERE p.post_type = 'hollerbox';" );
// Delete cached user meta
$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key in ('hollerbox_popup_conversions','hollerbox_closed_popups');" );
\Holler_Settings::instance()->drop();
wp_clear_scheduled_hook( 'hollerbox/telemetry' );
}