Guide

Schema Sitemap architecture

Daily sitemaps are stored as a custom post type entry per date. Generated XML lives in post meta so heavy archives are not rebuilt on every request. Archive index pages can still render on demand.

Generation flow

Default WP-Cron processing walks years → months → days:

  1. Collect years with posts and store them in options.
  2. Schedule a cron event for the first year.
  3. Expand months for that year, then days for each month.
  4. Generate the sitemap for each day, then advance until the range is done.

Async generation avoids timeouts and memory limits on large catalogues.

Flow

Cron generation

4 relationships
Options track the remaining work queue between cron ticks.

Cache

includes/class-prc-sitemap-cache.php implements a three-tier cache suited to low-frequency publishing:

TierTypical TTLUse
Short15 minutesAdmin UI interactions
Standard12 hoursSitemap data (invalidated on publish)
Long24 hoursYear ranges and taxonomy lists

See PERFORMANCE-IMPROVEMENTS.md for the full cache design.

WP-CLI

Command namespace from source: wp prc sitemap (includes/wp-cli.php).

SubcommandPurpose
generate-sitemapFull site sitemap generation
generate-sitemap-for-yearOne calendar year
generate-sitemap-for-year-monthOne year-month
generate-sitemap-for-year-month-dayOne day
recount-indexed-postsRecount indexed posts vs sitemap entries
Additional range/clear helpersDate-range generation and cache clear (see wp help prc sitemap)
Generate sitemaps bash
wp prc sitemap generate-sitemap

Halt processing by setting the prc_stop_processing option; the CLI checks that flag between days.

Filters

FilterRole
prc_sitemap_entryAlter URLs inside a daily posts sitemap
prc_sitemap_indexExclude daily sitemaps from the index by date
prc_sitemap_supported_taxonomiesTaxonomies that opt into taxonomy sitemaps (used by other plugins)

Root sitemap URLs follow home_url. There is no plugin-specific filter for those links; filter home_url when a reverse proxy needs different hosts.

Templates

XML templates live under templates/ (sitemap-index.php, sitemap-posts.php, sitemap-news.php, taxonomy templates, and specialized indexes).

Was this helpful?