[wp-trac] [WordPress Trac] #39947: REST API: Sticky post query returns unsticky posts when no posts are sticky
WordPress Trac
noreply at wordpress.org
Thu Feb 23 01:46:12 UTC 2017
#39947: REST API: Sticky post query returns unsticky posts when no posts are sticky
--------------------------+-----------------------------
Reporter: ryelle | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
When getting sticky posts from the API (for example, `site.com/wp-
json/wp/v2/posts?sticky=true`), if there are no sticky posts set, the
query just returns all posts — as if `sticky` was not set. I was expecting
an empty array. If there are sticky posts, it behaves as expected, only
returning the sticky posts.
The source seems to be [https://core.trac.wordpress.org/browser/trunk/src
/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php#L222
this check in WP_REST_Posts_Controller].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39947>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list