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:
parent
b8e3d63fdd
commit
69e876747d
|
@ -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 ),
|
||||
);
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue