From e8bf92cf760cab78e0307599538403370231f0fb Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Wed, 23 Mar 2022 10:39:06 +0000 Subject: [PATCH] Query: Improved sticky post query Ensure that the parameters `update_post_meta_cache`, `update_post_term_cache`, `cache_results`, `suppress_filters` and `lazy_load_term_meta` that are passed to WP_Query, are also passed down to the secondary query used to get sticky posts. Props Spacedmonkey, peterwilsoncc, rehanali, uday17035. Fixes #36907. Built from https://develop.svn.wordpress.org/trunk@52982 git-svn-id: http://core.svn.wordpress.org/trunk@52571 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-query.php | 12 ++++++++---- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index 79bad783e1..ac0faa3edb 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -3260,10 +3260,14 @@ class WP_Query { if ( ! empty( $sticky_posts ) ) { $stickies = get_posts( array( - 'post__in' => $sticky_posts, - 'post_type' => $post_type, - 'post_status' => 'publish', - 'nopaging' => true, + 'cache_results' => $q['cache_results'], + 'lazy_load_term_meta' => $q['lazy_load_term_meta'], + 'post__in' => $sticky_posts, + 'post_type' => $post_type, + 'post_status' => 'publish', + 'suppress_filters' => $q['suppress_filters'], + 'update_post_meta_cache' => $q['update_post_meta_cache'], + 'update_post_term_cache' => $q['update_post_term_cache'], ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index e2eff136d9..2958735820 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52981'; +$wp_version = '6.0-alpha-52982'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.