-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
46 lines (44 loc) · 1.18 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
<?php
// if uninstall.php is not called by WordPress, die
if (!defined('WP_UNINSTALL_PLUGIN')) {
die;
}
//delte options
$options = array(
//setting option
"ja_postviews_options",
//configuration option
"ja_configration_dissmiss",
//cron options
'ja_postviews_day_first',
'ja_postviews_day_second',
'ja_postviews_day_third',
'ja_postviews_day_fourth',
'ja_postviews_day_fifth',
'ja_postviews_day_sixth',
'ja_postviews_day_seventh',
'ja_postviews_week_first',
'ja_postviews_week_second',
'ja_postviews_week_third',
'ja_postviews_week_fourth',
//widgets
'widget_rngja_papular_posts'
);
foreach ($options as $option) {
if (get_option($option)) {
delete_option($option);
}
}
// drop a metadata
global $wpdb;
$wpdb->query("DELETE FROM {$wpdb->prefix}postmeta WHERE meta_key = 'ja_postviews'");
//clear crones
if (wp_next_scheduled('ja_postviews_db_day')) {
wp_clear_scheduled_hook("ja_postviews_db_day");
}
if (wp_next_scheduled('ja_postviews_db_week')) {
wp_clear_scheduled_hook("ja_postviews_db_week");
}
if (wp_next_scheduled('ja_postviews_mail_week')) {
wp_clear_scheduled_hook("ja_postviews_mail_week");
}