-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
49 lines (37 loc) · 1.26 KB
/
uninstall.php
File metadata and controls
49 lines (37 loc) · 1.26 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
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
*
* Description: uninstall script - PostMapTableView -automatically run by WP
* Author: Martin von Berg
* Author URI: https://www.berg-reise-foto.de/software-wordpress-lightroom-plugins/wordpress-plugins-fotos-und-gpx/
* License: GPL-2.0
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
// delete options in wp_options in the database at uninstall of the plugin
// if uninstall.php is not called by WordPress, die
if ( ! defined('WP_UNINSTALL_PLUGIN') ) {
die;
}
$chunk_keys = get_option('post_map_array_chunk_keys', []);
foreach ($chunk_keys as $chunk_key) {
delete_option($chunk_key);
}
delete_option('post_map_array_chunk_keys');
// die keys mit wpID am Ende löschen
global $wpdb;
$prefix = 'post_map_array_chunk_keys_';
$results = $wpdb->get_results(
$wpdb->prepare(
"SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s",
$prefix . '%'
)
);
if ( !empty( $results)) {
foreach ( $results as $result) {
$chunk_keys = get_option($result->option_name, []);
foreach ($chunk_keys as $chunk_key) {
delete_option($chunk_key);
}
delete_option( $result->option_name);
}
};