From ae9e63805d19167d07c43febc19f67d9b863e74b Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Wed, 24 Feb 2016 21:44:26 +0000 Subject: [PATCH] Permit sticky posts to affect the query in REST_REQUEST Needed for https://github.com/WP-API/WP-API/issues/2210 Props danielbachhuber. Fixes #35907. Built from https://develop.svn.wordpress.org/trunk@36696 git-svn-id: http://core.svn.wordpress.org/trunk@36663 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 4b3e1e41f7..76a17bfd0a 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -3705,7 +3705,7 @@ class WP_Query { // Put sticky posts at the top of the posts array $sticky_posts = get_option('sticky_posts'); - if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) { + if ( ( $this->is_home || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) { $num_posts = count($this->posts); $sticky_offset = 0; // Loop over posts and relocate stickies to the front. diff --git a/wp-includes/version.php b/wp-includes/version.php index 16d23e257e..e8a617dec0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36695'; +$wp_version = '4.5-alpha-36696'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.