[wp-trac] [WordPress Trac] #63360: ignore_sticky_posts generating a wrong behaviour in WP_Query

WordPress Trac noreply at wordpress.org
Sun Apr 27 16:05:54 UTC 2025


#63360: ignore_sticky_posts generating a wrong behaviour in WP_Query
--------------------------+------------------------------------------
 Reporter:  SirLouen      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  6.8
 Severity:  blocker       |   Keywords:  needs-patch has-testing-info
  Focuses:                |
--------------------------+------------------------------------------
 == Bug Report
 === Description
 According to the docs:
 > `ignore_sticky_posts` (boolean) – ignore post stickiness (available
 since version 3.1, replaced caller_get_posts parameter). false (default):
 **move sticky posts to the start of the set**. true: do not move sticky
 posts to the start of the set.

 Something is going wrong with `ignore_sticky_posts` behavior when certain
 `WP_Query` args are being used (the `__in` ones more specifically).

 More importantly, since, `ignore_sticky_posts` is `false` by default, it
 can be easily reproduced as soon as we use any of these arguments for the
 query.

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.28
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 135.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.2
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Steps to Reproduce
 1. Install this simple plugin for testing:
 https://raw.githubusercontent.com/SirLouen/wp-query-tester/refs/tags/1.0.1
 /wp-query-tester.php
 2. Create a second username
 3. Create some posts in this order:
 - First post, make sticky
 - Second not sticky post. Call it exactly, "Not Sticky 1", with slug "not-
 sticky-1".
 - Third, make sticky post
 - Fourth not sticky post
 - Fifth a sticky post, with second username as author
 - Sixth, not sticky with second username as author

 3. Create another post and add the short code `[wp_query_tester]`
 4. 🐞 Bug occurs

 === Expected Results
 - Query 1: All posts with sticky on top
 - Query 2: All posts ignoring the stickyness
 - Query 3: All posts from Author 1
 - Query 4: The post with slug "not-sticky"

 === Actual Results
 1. Query 1 is ✅
 - Query 2 is ✅
 - Query 3 is ❌. Queried only author 1. A post from author 2 appears
 (because its sticky)
 - Query 4 is ❌. Queried just the slug not-sticky-1. All sticky posts
 appear, the last one is the one queried.

 === Additional Notes
 This topic is seriously correlated with this issue #63307 just as a
 reference.

 === Supplemental Artifacts
 Plugin repo: https://github.com/SirLouen/wp-query-tester/

 Screenshot Sample

 [[Image(https://i.imgur.com/ILiKfgs.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63360>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list