forked from image-source-control/image-source-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
22 lines (19 loc) · 876 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
<?php
if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();
}
// check if the option to remove data on uninstall is enabled
$options = get_option( 'isc_options' );
if ( ! empty( $options['remove_on_uninstall'] ) ) {
global $wpdb;
// delete post meta fields
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => 'isc_post_images' ), array( '%s' ) );
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => 'isc_image_posts' ), array( '%s' ) );
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => 'isc_image_source' ), array( '%s' ) );
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => 'isc_image_source_own' ), array( '%s' ) );
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => 'isc_image_source_url' ), array( '%s' ) );
// delete main plugin options
delete_option( 'isc_options' );
// delete storage
delete_option( 'isc_storage' );
}