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:
- Collect years with posts and store them in options.
- Schedule a cron event for the first year.
- Expand months for that year, then days for each month.
- Generate the sitemap for each day, then advance until the range is done.
Async generation avoids timeouts and memory limits on large catalogues.
Cron generation
Cache
includes/class-prc-sitemap-cache.php implements a three-tier cache suited to low-frequency publishing:
| Tier | Typical TTL | Use |
|---|---|---|
| Short | 15 minutes | Admin UI interactions |
| Standard | 12 hours | Sitemap data (invalidated on publish) |
| Long | 24 hours | Year 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).
| Subcommand | Purpose |
|---|---|
generate-sitemap | Full site sitemap generation |
generate-sitemap-for-year | One calendar year |
generate-sitemap-for-year-month | One year-month |
generate-sitemap-for-year-month-day | One day |
recount-indexed-posts | Recount indexed posts vs sitemap entries |
| Additional range/clear helpers | Date-range generation and cache clear (see wp help prc sitemap) |
wp prc sitemap generate-sitemapHalt processing by setting the prc_stop_processing option; the CLI checks that flag between days.
Filters
| Filter | Role |
|---|---|
prc_sitemap_entry | Alter URLs inside a daily posts sitemap |
prc_sitemap_index | Exclude daily sitemaps from the index by date |
prc_sitemap_supported_taxonomies | Taxonomies 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).