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. git-svn-id: https://develop.svn.wordpress.org/trunk@48282 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
950b6ed272
commit
65a6412681
@ -92,13 +92,6 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
|
|||||||
|
|
||||||
$query = new WP_Query( $args );
|
$query = new WP_Query( $args );
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of posts.
|
|
||||||
*
|
|
||||||
* @var array<int, \WP_Post> $posts
|
|
||||||
*/
|
|
||||||
$posts = $query->get_posts();
|
|
||||||
|
|
||||||
$url_list = array();
|
$url_list = array();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -122,7 +115,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
|
|||||||
$url_list[] = $sitemap_entry;
|
$url_list[] = $sitemap_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $posts as $post ) {
|
foreach ( $query->posts as $post ) {
|
||||||
$sitemap_entry = array(
|
$sitemap_entry = array(
|
||||||
'loc' => get_permalink( $post ),
|
'loc' => get_permalink( $post ),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user