// ===== TÄGLICHER CRONJOB (inkl. Selbstheilung und Bing/IndexNow) ===== add_action('rss_daily_data_update', 'rss_daily_update_all_domains'); function rss_daily_update_all_domains() { if (!is_multisite()) return; rss_log("🔄 DAILY UPDATE START", null, 'CRON'); $sites = get_sites(['number' => 0]); $total = count($sites); $success = 0; $repaired = 0; foreach ($sites as $site) { switch_to_blog($site->blog_id); $site_url = get_site_url(); $sitemap_url = home_url('/sitemap.xml'); $home_url = home_url('/'); // Prüfe, ob die Sitemap gültiges XML liefert (Selbstheilung) $response = wp_remote_get($sitemap_url, [ 'timeout' => 10, 'httpversion' => '1.1' ]); $needs_repair = false; if (is_wp_error($response)) { rss_log("❌ Sitemap nicht erreichbar: " . $response->get_error_message(), $site->blog_id, 'CRON_CHECK'); $needs_repair = true; } else { $http_code = wp_remote_retrieve_response_code($response); if ($http_code !== 200) { rss_log("❌ HTTP-Fehler $http_code beim Aufruf der Sitemap", $site->blog_id, 'CRON_CHECK'); $needs_repair = true; } else { $body = wp_remote_retrieve_body($response); $content_type = wp_remote_retrieve_header($response, 'content-type'); if (strpos($content_type, 'xml') === false) { rss_log("⚠️ Kein XML-Content-Type: $content_type", $site->blog_id, 'CRON_CHECK'); $needs_repair = true; } else { libxml_use_internal_errors(true); $xml = simplexml_load_string($body); libxml_clear_errors(); if ($xml === false) { rss_log("❌ Kein gültiges XML", $site->blog_id, 'CRON_CHECK'); $needs_repair = true; } else { $found = false; foreach ($xml->url as $url) { if (trim((string)$url->loc) === $home_url) { $found = true; break; } } if (!$found) { rss_log("❌ Startseite nicht in Sitemap gefunden", $site->blog_id, 'CRON_CHECK'); $needs_repair = true; } } } } } if ($needs_repair) { rss_log("🛠️ Reparatur für Blog $site->blog_id erforderlich", $site->blog_id, 'CRON_REPAIR'); rss_flush_rewrite_for_blog($site->blog_id); $repaired++; } // *** BING INDEXNOW SUBMIT (NEU) *** $bing_ok = rss_indexnow_submit($sitemap_url); if ($bing_ok) { rss_log("✅ Bing/IndexNow submitted für Sitemap", $site->blog_id, 'BING_CRON'); } else { rss_log("⚠️ Bing/IndexNow fehlgeschlagen", $site->blog_id, 'BING_CRON'); } // Google-Cleanup & Submit $cleanup_ok = rss_cleanup_daily_sitemap($site_url); if ($cleanup_ok) { $success++; } restore_current_blog(); } rss_log("✅ DAILY UPDATE COMPLETE: $success/$total Google-Submits erfolgreich, $repaired Domains repariert, Bing/IndexNow für alle ausgeführt", null, 'CRON'); } Gesundheitnachrichten.de – Täglich aktuelle Nachrichten über die Gesundheit –

Gesundheit-Thema des Tages

Gesundheits-NEWS

Trends