Files
IQ-Dynamic-Google-Pricing/uninstall.php

36 lines
1.0 KiB
PHP

<?php
/**
* Uninstall script - Clean up plugin data on uninstall.
*
* @package InformatiqSmartPricing
*/
// Exit if uninstall not called from WordPress.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Delete plugin options.
delete_option( 'informatiq_sp_merchant_id' );
delete_option( 'informatiq_sp_service_account' );
delete_option( 'informatiq_sp_minimum_margin' );
delete_option( 'informatiq_sp_auto_update_enabled' );
delete_option( 'informatiq_sp_update_frequency' );
delete_option( 'informatiq_sp_last_run_start' );
delete_option( 'informatiq_sp_last_run_end' );
delete_option( 'informatiq_sp_last_run_results' );
// Clear scheduled cron events.
$timestamp = wp_next_scheduled( 'informatiq_sp_daily_price_update' );
if ( $timestamp ) {
wp_unschedule_event( $timestamp, 'informatiq_sp_daily_price_update' );
}
// Drop custom database table.
global $wpdb;
$table_name = $wpdb->prefix . 'informatiq_sp_logs';
$wpdb->query( "DROP TABLE IF EXISTS {$table_name}" );
// Clear any cached data.
wp_cache_flush();