-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
30 lines (26 loc) · 859 Bytes
/
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
<?php
/**
* Fired when the plugin is uninstalled.
* // TODO: Multisite support
* // TODO: Batch processing for sites with problematically huge numbers of posts
*
* @since 1.0.0
* @package Breadcrumbs
*/
// If uninstall not called from WordPress, then exit.
if (!defined( 'WP_UNINSTALL_PLUGIN')) {
exit;
}
// Delete the breadcrumbs_settings from wp_options table
delete_option('breadcrumbs_settings');
// Delete the breadcrumb_title_override meta field from posts
// Note: Not using a meta query looking for the override here
// because we want to delete it from the postmeta table even if it's empty
$args = array(
'posts_per_page' => -1,
);
$all_posts = new WP_Query($args);
$all_post_ids = wp_list_pluck($all_posts->posts, 'ID');
foreach($all_post_ids as $this_post_id) {
delete_post_meta($this_post_id, 'breadcrumb_title_override');
}