WordPress.org

Make WordPress Core

Changeset 36696


Ignore:
Timestamp:
02/24/2016 09:43:15 PM (4 years ago)
Author:
jorbin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r36647 r36696  
    37063706        // Put sticky posts at the top of the posts array
    37073707        $sticky_posts = get_option('sticky_posts');
    3708         if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) {
     3708        if ( ( $this->is_home || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) {
    37093709            $num_posts = count($this->posts);
    37103710            $sticky_offset = 0;
Note: See TracChangeset for help on using the changeset viewer.