-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathuninstall.php
25 lines (20 loc) · 868 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
<?php
/**
* Code used when the plugin is removed (not just deactivated but actively deleted by the WordPress Admin).
*
* @package WordPress\Plugins\Demo_Quotes_Plugin
* @subpackage Uninstall
*/
if ( ! current_user_can( 'activate_plugins' ) || ( ! defined( 'ABSPATH' ) || ! defined( 'WP_UNINSTALL_PLUGIN' ) ) ) {
exit();
}
$options = get_option( 'demo_quotes_plugin_options' );
if ( isset( $options['uninstall']['delete_taxonomy'] ) && 'DELETE' === $options['uninstall']['delete_taxonomy'] ) {
// Get all terms with our taxonomy & all relationships to these.
// Delete.
}
if ( isset( $options['uninstall']['delete_posts'] ) && 'DELETE' === $options['uninstall']['delete_posts'] ) {
// Get all posts with our post_type & all posts where a post with our post_type is the post_parent (revisions).
// Delete.
}
delete_option( 'demo_quotes_plugin_options' );