[wp-trac] [WordPress Trac] #55633: First sitemap has more URLs than expected with sticky posts
WordPress Trac
noreply at wordpress.org
Wed Apr 27 17:45:02 UTC 2022
#55633: First sitemap has more URLs than expected with sticky posts
--------------------------+-----------------------------
Reporter: RavanH | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Sitemaps | Version: 5.9.3
Severity: minor | Keywords:
Focuses: |
--------------------------+-----------------------------
When a site has $x sticky posts, and more posts than $max_urls (2000 by
default) then the first posts sitemap will have $max_urls + $x URLs.
Not a big issue unless there are a huge number of sticky posts and the
site is running on a relatively low resource server... Still, an
unexpected sitemap size and it is easily fixed by setting
ignore_sticky_posts :)
{{{#!php
<?php
function wpsm_posts_query_args( $args ) {
// Ignore stickyness.
$args['ignore_sticky_posts'] = true;
return $args;
}
add_filter( 'wp_sitemaps_posts_query_args', 'wpsm_posts_query_args' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55633>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list