forked from wp-plugins/featured-articles-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
30 lines (26 loc) · 820 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
<?php
if( !defined('ABSPATH') || !defined('WP_UNINSTALL_PLUGIN') ){
die();
}
$options = get_option( 'fa_plugin_options', array() );
if( isset( $options['settings']['complete_uninstall'] ) && $options['settings']['complete_uninstall'] ){
// 1. Remove plugin options
delete_option('fa_plugin_options');
// 2. Remove Custom Post Slider
$args = array(
'post_type' => 'fa_slider',
'post_status' => 'any'
);
$sliders = get_posts( $args );
if( $sliders ){
foreach( $sliders as $slider ){
wp_delete_post( $slider->ID, true );
}
}
// 4. Remove Slide Options from other posts used as slides
global $wpdb;
$query = "DELETE FROM {$wpdb->postmeta} WHERE meta_key = '_fa_slide_settings'";
$wpdb->query( $query );
// 5. Delete transients
delete_transient('fa_version');
}