From 69e876747d790c6b28ea5042035f27c1b11e9d16 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 3 Jul 2020 12:03:01 +0000 Subject: [PATCH] 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 --- .../sitemaps/providers/class-wp-sitemaps-posts.php | 9 +-------- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php b/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php index 54e83e913b..3ec20bf23f 100644 --- a/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php +++ b/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php @@ -92,13 +92,6 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider { $query = new WP_Query( $args ); - /** - * Returns an array of posts. - * - * @var array $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 ), ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 60ae477d2d..1ddb438e7f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.