[wp-trac] [WordPress Trac] #63339: WordPress 6.8 REST API returns all sticky posts regardless of per_page setting

WordPress Trac noreply at wordpress.org
Wed Apr 23 19:15:14 UTC 2025


#63339: WordPress 6.8 REST API returns all sticky posts regardless of per_page
setting
-------------------------------------+------------------------------
 Reporter:  se8820726                |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  REST API                 |     Version:  6.8
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------------
Changes (by abcd95):

 * keywords:  has-patch => has-patch needs-testing


Comment:

 Hi @se8820726, and thanks for the ticket.

 I've been able to reproduce the problem exactly as you described. The
 issue occurs because in 6.8, when requesting posts with the `per_page`
 parameter but without specifying the sticky parameter, the system prepends
 all sticky posts to the result set without respecting the pagination
 limit.

 I've created a patch that ensures the `per_page` parameter is properly
 respected in all cases. The solution adds a check to ignore sticky post
 behavior when pagination is requested, but no explicit sticky preference
 is specified.

 Let me know if the patch tests well for you.

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


More information about the wp-trac mailing list