PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.13.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.13.0
2.13.0 2.12.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 All 54 releases
← All changes | includes/seo/class-sitemap-generator.php +26 -7 2.11.0 → 2.13.0 View file →
@@ -2408,12 +2408,13 @@
2408 2408 if ($usage > $limit - $headroom) {
2409 2409 throw new \Error(
2410 2410 sprintf(
2411 2411 /* translators: 1: memory in use, 2: PHP memory limit. */
2412 - __('The sitemap rebuild was stopped at %1$s of the %2$s PHP memory limit, before PHP would have run out of memory. It will be retried by a process with more memory (WP-CLI or a system cron). To let it finish in the admin, raise the PHP memory_limit.', 'thinkrank'),
2413 - size_format($usage),
2414 - size_format($limit)
2412 + esc_html__('The sitemap rebuild was stopped at %1$s of the %2$s PHP memory limit, before PHP would have run out of memory. It will be retried by a process with more memory (WP-CLI or a system cron). To let it finish in the admin, raise the PHP memory_limit.', 'thinkrank'),
2413 + esc_html((string) size_format($usage)),
2414 + esc_html((string) size_format($limit))
2415 2415 ),
2416 + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- an integer class constant, not output.
2416 2417 self::MEMORY_ABORT_CODE
2417 2418 );
2418 2419 }
2419 2420 }
@@ -3814,12 +3815,30 @@
3814 3815 $buffer = [];
3815 3816 }
3816 3817 }
3817 3818
3818 - // Flush the trailing partial page, or a single empty page when the
3819 - // type had no entries at all (parity with the previous behavior of
3820 - // always writing at least one page per configured child).
3821 - if (!empty($buffer) || $page === 0) {
3819 + // Flush the trailing partial page.
3820 + //
3821 + // A type that produced nothing writes no page at all in index
3822 + // mode (#836). It used to write one empty urlset and list it in
3823 + // the index, so a crawler was asked to fetch a file that
3824 + // answers with no URLs — Search Console reports an empty
3825 + // sitemap referenced from an index as a warning, and the fetch
3826 + // is wasted on every pass. On this site three of eleven
3827 + // children were empty: a post type with nothing published and
3828 + // two taxonomies with no terms.
3829 + //
3830 + // Single-file mode still writes its one page even when empty,
3831 + // because that file IS the site's /sitemap.xml and a 404 there
3832 + // is worse than an empty urlset. Nothing lists it, so it costs
3833 + // no crawl budget.
3834 + //
3835 + // Skipping the write also keeps the filename out of
3836 + // $results['sitemaps_generated'], which is what
3837 + // prune_orphaned_segments() treats as "written this run" — so
3838 + // a type that empties after previously publishing has its
3839 + // stale file deleted rather than left serving.
3840 + if (!empty($buffer) || ($page === 0 && $index_config === null)) {
3822 3841 $page++;
3823 3842 $this->write_sitemap_page($this->paginate_url($sitemap_config['url'], $page), $this->wrap_urlset($buffer, $settings, $image_ns), $type, count($buffer), $results, $index_children);
3824 3843 }
3825 3844