[wp-trac] [WordPress Trac] #63307: REST API: Returns incorrect post when querying by slug if sticky posts exist
WordPress Trac
noreply at wordpress.org
Mon Apr 21 08:21:24 UTC 2025
#63307: REST API: Returns incorrect post when querying by slug if sticky posts
exist
------------------------------------------------+--------------------------
Reporter: wpmudevsupport13 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: REST API | Version: 6.8
Severity: normal | Resolution:
Keywords: changes-requested has-testing-info | Focuses: rest-api
------------------------------------------------+--------------------------
Comment (by nikunj8866):
@SirLouen Thank you for the detailed test report and for highlighting the
side effect introduced by the patch.
It does change the default behavior of sticky posts being prioritized at
the top of the main REST response (/wp-json/wp/v2/posts), which was an
intentional feature.
So for users who are specifically querying posts by slug and need
consistent results regardless of sticky status, the recommended approach
is to use the **ignore_sticky=true** parameter. For example: **/wp-
json/wp/v2/posts?slug=test-post&ignore_sticky=true**
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63307#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list