[wp-trac] [WordPress Trac] #63307: REST API: Returns incorrect post when querying by slug if sticky posts exist

WordPress Trac noreply at wordpress.org
Thu Apr 24 08:38:17 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
  2nd-opinion has-patch needs-testing            |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  changes-requested has-testing-info 2nd-opinion has-patch =>
     changes-requested has-testing-info 2nd-opinion has-patch needs-testing


Comment:

 Replying to [comment:8 nikunj8866]:
 > Let us know what you think about this. We’re happy to help with a patch
 or more suggestions if needed.
 As I commented in my Test Report, you are not solving the issue, you are
 just hindering it.

 If you do this, for example, with your patch:

 http://localhost:8889/wp-json/wp/v2/posts?slug=test-
 post&ignore_sticky=false

 It will return the post "test-post" **and** all the sticky posts. This is
 not the expected behavior.

 Sticky posts are meant to be shown just on listing queries, not on
 individual records queries.
 And sticky posts should be displayed by default on listings, unless
 explicitly specified with the given filter, not the opposite.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63307#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list