[wp-trac] [WordPress Trac] #51117: Sitemap & XSL requests execute main query for home page.

WordPress Trac noreply at wordpress.org
Mon Mar 23 05:57:00 UTC 2026


#51117: Sitemap & XSL requests execute main query for home page.
---------------------------+------------------------------
 Reporter:  peterwilsoncc  |       Owner:  pbiron
     Type:  defect (bug)   |      Status:  accepted
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Sitemaps       |     Version:  5.5
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:  performance
---------------------------+------------------------------

Comment (by JayFry):

 Replying to [comment:9 RavanH]:
 > Currently using the following as a patch (via plugin) solving all
 issues. The functions `is_sitemap()` and `is_sitemap_stylesheet()` are not
 technically needed in this context but seem logical to have available (and
 use)...
 >
 > Note that hooking `wp_sitemaps_loaded()` into `parse_request` will
 render the sitemap (or stylesheet) early and then exit, thereby skipping
 the unneeded main query altogether.
 >
 > {{{#!php
 > <?php
 > ...

 Thank you! Could you push this code to core? The issue is 5 years old.
 It's time for somebody competent to do something about it. It's ridiculous
 how long this crucial issue persists unresolved.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51117#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list