-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathuninstall.php
More file actions
35 lines (30 loc) · 895 Bytes
/
uninstall.php
File metadata and controls
35 lines (30 loc) · 895 Bytes
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
<?php
/*
* Delete all data for Literally WordPress
*
* @package literally_wordpress
* @since 0.8.6
*/
//Check whether WordPress is initialized or not.
if(!defined( 'ABSPATH') && !defined('WP_UNINSTALL_PLUGIN')){
exit();
}
//Include Class file
require_once dirname(__FILE__).DIRECTORY_SEPARATOR."literally-wordpress-statics.php";
//Get global scope variable for the precaution.
/* @var $wpdb wpdb*/
global $wpdb;
//Delete All Tables
foreach(LWP_Tables::get_tables() as $table){
$sql = "DROP TABLE `{$table}`";
$wpdb->query($sql);
}
//Delete All Notifications
$notification_ids = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'lwp_notification'");
foreach($notification_ids as $id){
wp_delete_post($id, true);
}
//Delete Option
delete_option('literally_wordpress_option');
delete_option('lwp_refund_message');
wp_clear_scheduled_hook('lwp_daily_notification');