[wp-trac] [WordPress Trac] #63360: ignore_sticky_posts generating a wrong behaviour in WP_Query
WordPress Trac
noreply at wordpress.org
Wed Jun 4 15:01:17 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 | Resolution:
Keywords: needs-patch has-test-info | Focuses:
---------------------------------------+------------------------------
Comment (by gautam23):
I was able to reproduce this issue as per the steps provided by @SirLouen
**Steps Taken:**
Exactly as described by OP in ticket:
1. Installed the said plugin: https://raw.githubusercontent.com/SirLouen
/wp-query-tester/refs/tags/1.0.1/wp-query-tester.php
2. Created a second username called "User 2"
3. Created some posts in this order:
* First post, made sticky
* Second not sticky post. Called it exactly, "Not Sticky 1", with slug
"not-sticky-1".
* Third, made sticky post
* Fourth not sticky post
* Fifth a sticky post, with "User 2" as author
* Sixth, not sticky with "User 2" as author
* Created another post called "Post List" and added the short code
`[wp_query_tester]` in it
**Result:**
Able to reproduce the issue.
**Screenshot:**
[[Image(https://i.ibb.co/KjYfpYvV/Screenshot-2025-06-04-at-8-08-12-PM.png)]]
**PS:**
If I add `'ignore_sticky_posts' => 1` to both the queries where the result
is "unexpected", it works as "expected". Notably, the
docs(https://developer.wordpress.org/reference/classes/wp_query/#post-
page-parameters) mention that when using `post__in`, the sticky posts are
prepended to the query results, whether you want it or not. But no such
thing is written for `post_name__in` or `author__in`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63360#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list