[wp-trac] [WordPress Trac] #51860: wp-sitemap includes empty post entries returned by filters

WordPress Trac noreply at wordpress.org
Tue Nov 24 08:22:40 UTC 2020


#51860: wp-sitemap includes empty post entries returned by filters
-------------------------+------------------------------
 Reporter:  jsmoriss     |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Sitemaps     |     Version:  5.5
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------
Changes (by swissspidy):

 * type:  defect (bug) => enhancement


Comment:

 > return an empty array (as another way to exclude a post from the
 sitemap, for example)

 Just for reference, the filter was actually deliberately implemented so
 that this is _not_ possible as it would mess with pagination. So it was
 never recommended to return an empty array. Instead, the WP_Query args
 should be filtered to exclude posts.

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


More information about the wp-trac mailing list