query($wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like('aivesese_analytics_') . '%' )); $wpdb->query($wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like('aivesese_opportunity_shown_') . '%' )); // Clean up user meta for help toggle delete_metadata('user', 0, '_aivesese_help_open', '', true); // Clear all scheduled hooks if (function_exists('wp_clear_scheduled_hook')) { wp_clear_scheduled_hook('aivesese_rebuild_lite_index'); wp_clear_scheduled_hook('aivs_cleanup_analytics'); } // Delete all transients and cached data $transient_prefixes = [ 'aivesese_lite_index_', 'fts_', 'sem_', 'recs_', 'aivesese_sim_', ]; foreach ($transient_prefixes as $prefix) { $escaped_prefix = $wpdb->esc_like($prefix) . '%'; $wpdb->query($wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", '_transient_' . $escaped_prefix, '_transient_timeout_' . $escaped_prefix )); } // Drop analytics table if it exists $table_name = $wpdb->prefix . 'aivs_search_analytics'; $wpdb->query("DROP TABLE IF EXISTS {$table_name}"); // Clear object cache if available if (function_exists('wp_cache_flush')) { wp_cache_flush(); }