Sitemaps: Do not unnecessarily call `WP_Query::get_posts()` in posts provider.

The posts have already been fetched at this point, no need to do it again.

Props Chouby.
Fixes #50463.
Built from https://develop.svn.wordpress.org/trunk@48282


git-svn-id: http://core.svn.wordpress.org/trunk@48051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2020-07-03 12:03:01 +00:00
parent b8e3d63fdd
commit 69e876747d
2 changed files with 2 additions and 9 deletions

View File

@ -92,13 +92,6 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
$query = new WP_Query( $args );
/**
* Returns an array of posts.
*
* @var array<int, \WP_Post> $posts
*/
$posts = $query->get_posts();
$url_list = array();
/*
@ -122,7 +115,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
$url_list[] = $sitemap_entry;
}
foreach ( $posts as $post ) {
foreach ( $query->posts as $post ) {
$sitemap_entry = array(
'loc' => get_permalink( $post ),
);

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-48281';
$wp_version = '5.5-alpha-48282';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.