query("DROP TABLE IF EXISTS {$wpdb->prefix}{$aiflt_table}"); } // 2. Delete plugin options. Do not delete unrelated addon options unless they are plugin-owned. $aiflt_options = [ 'aiflt_db_version', 'aiflt_activation_time', 'aiflt_ai_provider', 'aiflt_ai_external_consent', 'aiflt_ai_aggregate_only', 'aiflt_free_ai_monthly_limit', 'aiflt_ai_api_key', 'aiflt_zywrap_api_key', 'aiflt_zywrap_endpoint', 'aiflt_pro_license_key', 'aiflt_license_server_url', 'aiflt_license_activation_table_version', 'aiflt_ai_model', 'aiflt_ai_response_language', 'aiflt_data_retention', 'aiflt_delete_data_on_uninstall', 'aiflt_anonymize_ip', 'aiflt_enable_tracking', 'aiflt_excluded_roles', 'aiflt_excluded_ips', 'aiflt_world_class_settings', 'aiflt_setup_completed_steps', 'aiftcr_settings', ]; foreach ($aiflt_options as $aiflt_option) { delete_option($aiflt_option); } // 3. Clear plugin transients. $aiflt_transients = [ 'aiflt_welcome_redirect', 'aiftaa_latest_full_report', 'aiftap_latest_prediction', 'aiflt_ai_report', 'aiflt_license_status_cache', 'aiflt_license_data_cache', ]; foreach ($aiflt_transients as $aiflt_transient) { delete_transient($aiflt_transient); } // 4. Clear scheduled events owned by the plugin. wp_clear_scheduled_hook('aiflt_daily_cleanup_event'); wp_clear_scheduled_hook('aiflt_weekly_summary_email_event'); wp_clear_scheduled_hook('aiflt_weekly_license_check_event'); }