-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
38 lines (33 loc) · 1.1 KB
/
Copy pathuninstall.php
File metadata and controls
38 lines (33 loc) · 1.1 KB
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
<?php
/**
* Uninstall script for LSAH Admin Help Search
*
* Runs when the plugin is deleted from the WordPress admin.
* Cleans up the database table and options.
*
* This file is automatically called by WordPress when the plugin is deleted.
*
* @package LSAH_Admin_Help_Search
*/
// Exit if uninstall is not called properly (direct access protection)
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
global $wpdb;
// Drop the network-wide searches table (safe for both single-site and multisite)
$lsah_table_name = $wpdb->base_prefix . 'lsah_admin_searches';
$wpdb->query("DROP TABLE IF EXISTS $lsah_table_name");
// Delete the stored site options (works correctly in both single-site and multisite)
delete_site_option('lsah_help_search_action_url');
delete_site_option('lsah_notice_set_help_url');
/**
* 3. Delete all user metadata related to search visibility
* We use a wildcard query to catch all 'lsah_hide_search_site_{ID}' entries
* @since 1.2.0
*/
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE %s",
'lsah_hide_search_site_%'
)
);