54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Uninstall Handler
|
|
*
|
|
* Cleans up plugin data on uninstall
|
|
*
|
|
* @package Igny8Bridge
|
|
*/
|
|
|
|
// If uninstall not called from WordPress, then exit
|
|
if (!defined('WP_UNINSTALL_PLUGIN')) {
|
|
exit;
|
|
}
|
|
|
|
// Remove all options
|
|
delete_option('igny8_access_token');
|
|
delete_option('igny8_refresh_token');
|
|
delete_option('igny8_email');
|
|
delete_option('igny8_site_id');
|
|
delete_option('igny8_last_site_sync');
|
|
delete_option('igny8_last_site_import_id');
|
|
delete_option('igny8_token_refreshed_at');
|
|
delete_option('igny8_bridge_version');
|
|
|
|
// Remove all post meta (optional - uncomment if you want to remove all meta on uninstall)
|
|
/*
|
|
global $wpdb;
|
|
$wpdb->query("
|
|
DELETE FROM {$wpdb->postmeta}
|
|
WHERE meta_key LIKE '_igny8_%'
|
|
");
|
|
*/
|
|
|
|
// Unschedule cron jobs
|
|
$timestamp = wp_next_scheduled('igny8_sync_post_statuses');
|
|
if ($timestamp) {
|
|
wp_unschedule_event($timestamp, 'igny8_sync_post_statuses');
|
|
}
|
|
|
|
$timestamp = wp_next_scheduled('igny8_sync_site_data');
|
|
if ($timestamp) {
|
|
wp_unschedule_event($timestamp, 'igny8_sync_site_data');
|
|
}
|
|
|
|
$timestamp = wp_next_scheduled('igny8_sync_from_igny8');
|
|
if ($timestamp) {
|
|
wp_unschedule_event($timestamp, 'igny8_sync_from_igny8');
|
|
}
|
|
|
|
// Note: Taxonomies and terms are NOT deleted
|
|
// They remain in WordPress for user reference
|
|
// Only the taxonomy registration is removed
|
|
|