-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathuninstall.php
More file actions
26 lines (21 loc) · 823 Bytes
/
uninstall.php
File metadata and controls
26 lines (21 loc) · 823 Bytes
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
<?php
/**
* Uninstall the plugin.
*
* Delete the plugin option and custom table.
*
* @package Progress_Planner\OptionOptimizer
*/
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
global $wpdb;
// Drop the custom table.
$aaa_option_optimizer_table = $wpdb->prefix . 'option_optimizer_tracked';
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is safe (from constant prefix).
$wpdb->query( "DROP TABLE IF EXISTS {$aaa_option_optimizer_table}" );
// Delete the batch transient.
delete_transient( 'option_optimizer_batch' );
// Delete the plugin option.
delete_option( 'option_optimizer' );