-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
32 lines (22 loc) · 1019 Bytes
/
uninstall.php
File metadata and controls
32 lines (22 loc) · 1019 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
<?php
// If uninstall.php is not called by WordPress, die
if (!defined('WP_UNINSTALL_PLUGIN')) {
die;
}
// Posts that were turned in to liveblogs are not removed,
// but the liveblog entries are removed.
/* 卸载时清空所有数据 请 慎重使用
global $wpdb;
$entries = get_posts( array( 'post_type' => 'microlive', 'post_status' => 'any', 'numberposts' => -1 ) );
foreach ( $entries as $entry ) {
wp_delete_post( $entry->ID, true );
}
$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_micro_live_post_id'" );
$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_micro_post_live_enable'" );
$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_micro_post_live_autoPolling'" );
$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_micro_post_live_status'" );
delete_option( 'microblog_liveblog_data' );
delete_option( 'theme_microblog_data' );
delete_option( 'widget_microblog_widget' );
// 还可以执行其他清理操作,如删除数据库条目等
*/