queries = []; // Starte frisch $start = microtime(true); error_log("📦 Query-Tracking gestartet für Produkt ID {$post_id}"); add_action('shutdown', function () use ($post_id, $start) { global $wpdb; if (!isset($wpdb->queries)) { error_log("⚠️ Produkt #{$post_id}: Keine Queries gesammelt – vielleicht wurde $wpdb->queries zwischendurch überschrieben."); return; } $total = count($wpdb->queries); $duration = round(microtime(true) - $start, 2); error_log("📊 Produkt #{$post_id} speichern: {$total} Queries ausgeführt in {$duration}s"); $tables = []; foreach ($wpdb->queries as $query) { $sql = $query[0]; $table = 'unknown'; if (preg_match('/FROM\s+([^\s;]+)/i', $sql, $matches)) { $table = $matches[1]; } elseif (preg_match('/INTO\s+([^\s;]+)/i', $sql, $matches)) { $table = $matches[1]; } elseif (preg_match('/UPDATE\s+([^\s;]+)/i', $sql, $matches)) { $table = $matches[1]; } $tables[$table] = ($tables[$table] ?? 0) + 1; } arsort($tables); error_log("📦 Tabellenverteilung für Produkt #{$post_id}:"); foreach ($tables as $table => $qty) { error_log("📦 {$table}: {$qty} Queries"); } }); }, 1, 3); ?> Shop - Seite 2 von 68 - die-werkkiste.de

Shop