[wp-trac] [WordPress Trac] #64458: Add ability to set different renders based on sitemap type
WordPress Trac
noreply at wordpress.org
Tue Dec 30 00:54:05 UTC 2025
#64458: Add ability to set different renders based on sitemap type
-------------------------+-----------------------------
Reporter: mboynes | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Sitemaps | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
I'm working on a plugin that extends the core sitemaps functionality to
add a News Sitemap. One area that got a little hacky was overriding the
core Renderer. Ideally, this would work exactly like how the Providers
work, extending `WP_Sitemaps_Registry` to also manage renderers. They
could similarly be keyed by a name, and if
`WP_Sitemaps::render_sitemaps()` has no renderer for the sitemap type, the
current renderer could be used as a fallback.
This would facilitate adding other sitemap types as discussed in #51016
and offers an alternative approach to what was discussed
[https://github.com/GoogleChromeLabs/wp-sitemaps/issues/151 in GitHub].
Adding a new Renderer would then look something like:
{{{#!php
add_action(
'wp_sitemaps_init',
function ( $wp_sitemaps ) {
$wp_sitemaps->registry->add_renderer( 'video', new
My_Video_Sitemap_Renderer() );
}
);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64458>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list