-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathuninstall.php
49 lines (39 loc) · 1.26 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
47
48
49
<?php
/**
* Uninstall Auto Load Next Post.
*
* @since 1.0.0
* @version 1.5.10
* @author Sébastien Dumont
* @category Core
* @package Auto Load Next Post
* @license GPL-2.0+
*/
if ( ! defined( 'ABSPATH' ) || ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit(); // Exit if accessed directly.
}
global $wpdb;
$uninstall = get_option( 'auto_load_next_post_uninstall_data' );
if ( ! empty( $uninstall ) ) {
// Make sure it is only a single site we are uninstalling from.
if ( ! is_multisite() ) {
// Delete options
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'auto_load_next_post_%'");
// Delete user interactions
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'auto_load_next_post_%'");
// Delete Uninstall Data - Just to double check it has been removed.
delete_option( 'auto_load_next_post_uninstall_data' );
// Delete Install Date
delete_option( 'auto_load_next_post_install_date' );
}
else {
// Delete Uninstall Data
delete_site_option( 'auto_load_next_post_uninstall_data' );
// Delete Install Date
delete_site_option( 'auto_load_next_post_install_date' );
}
}
// Clear any cached data that has been removed.
wp_cache_flush();
// Refresh permalinks to remove our rewrite endpoint.
flush_rewrite_rules();