[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 04:34:01 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                                    |
-------------------------------------------------+-------------------------
Changes (by nikunj8866):

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


Comment:

 @SirLouen When someone uses specific filters like slug, author, status,
 include, etc., they usually expect to get only the exact matching posts.
 Right now, if there's a sticky post with a newer date, it can wrongly
 appear instead of the correct post—for example, when using ?slug=test-
 post.

 We suggest that when these kinds of filters are used, API should
 automatically ignore sticky posts (unless the user specifically wants
 them). This would help make the results more accurate and avoid confusion
 for developers using the API.

 Let us know what you think about this. We’re happy to help with a patch or
 more suggestions if needed.

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


More information about the wp-trac mailing list