-
Notifications
You must be signed in to change notification settings - Fork 24
/
uninstall.php
48 lines (37 loc) · 1.13 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
<?php
/**
* SendPress Uninstall Scripts
*
*
* @package SendPress
* @author Josh Lyford
* @since 0.8.6
*/
//if uninstall not called from WordPress exit
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ){
exit();
}
global $wpdb, $wp_roles;
define( 'SENDPRESS_VERSION', '0.9.6.3' );
//Remove settings
/*
delete_option( 'sendpress_options' );
delete_option( 'sendpress_db_version' );
require_once plugin_dir_path( __FILE__ ) . 'classes/class-sendpress-pro-manager.php';
SendPress_Pro_Manager::try_deactivate_key();
$sp_post_types = array( 'sp_newsletters', 'sp_report', 'sptemplates', 'sendpress_list' );
foreach ( $sp_post_types as $post_type ) {
$items = get_posts( array( 'post_type' => $post_type, 'numberposts' => -1, 'fields' => 'ids' ) );
if ( $items ) {
foreach ( $items as $item ) {
delete_transient('sendpress_report_subject_' . $item );
delete_transient('sendpress_report_body_html_' . $item );
wp_delete_post( $item, true);
}
}
}
//Drop All DB tables
//This could use an updated for Multisite
require_once plugin_dir_path( __FILE__ ) . 'classes/class-sendpress-db-tables.php';
SendPress_DB_Tables::remove_all_data();
*/