-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.php
More file actions
31 lines (25 loc) · 776 Bytes
/
uninstall.php
File metadata and controls
31 lines (25 loc) · 776 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
27
28
29
30
31
<?php
declare(strict_types=1);
/**
* Substack Sync - WordPress Plugin
*
* Copyright (c) 2025 Christopher S. Penn
* Licensed under Apache License Version 2.0
*
* NO SUPPORT PROVIDED. USE AT YOUR OWN RISK.
*/
// If uninstall not called from WordPress, then exit.
if (! defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
// Get the plugin options
$options = get_option('substack_sync_settings');
// Check if the user wants to delete data
if (isset($options['delete_data_on_uninstall']) && $options['delete_data_on_uninstall']) {
// Delete plugin settings
delete_option('substack_sync_settings');
// Drop the custom database table
global $wpdb;
$table_name = $wpdb->prefix . 'substack_sync_log';
$wpdb->query("DROP TABLE IF EXISTS $table_name");
}