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

WordPress Trac noreply at wordpress.org
Fri Apr 25 23:26:02 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:  6.8.1
Component:  REST API                             |     Version:  6.8
 Severity:  critical                             |  Resolution:
 Keywords:  changes-requested has-testing-info   |     Focuses:  rest-api
  has-unit-tests dev-feedback has-patch          |
-------------------------------------------------+-------------------------

Comment (by jorbin):

 Thanks @Mamaduka!

 I think the challenge is that the wp/v2/posts endpoint has now also been
 around for a long time with it's own "old and odd behavior" that we need
 to be careful with.

 I think the best path is that in 6.8.1, keep the `ignore_sticky_posts`
 param that was added, but change the default in the rest API to `true`
 which will restore the behavior that the endpoint had from 4.7 -> 6.7. The
 Query Block can be modified to call the endpoint with
 `ignore_sticky_posts` set to `false`. We can then look at adding a new
 endpoint (`wp/v3/posts`? `wp/v2/wp_query`?) in 6.9 that more closely
 resembles `WP_Query`. This would honor the original REST API behavior for
 posts collection, while maintaining support for sticky posts.

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


More information about the wp-trac mailing list