[wp-trac] [WordPress Trac] #63359: ignore_sticky_posts generating a wrong behaviour in WP_Query (was: Are ignore_sticky_posts working as expected?)
WordPress Trac
noreply at wordpress.org
Mon Apr 28 18:00:34 UTC 2025
#63359: 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:
Severity: major | Resolution:
Keywords: needs-patch has-testing-info 2nd- | Focuses:
opinion |
-------------------------------------------------+-------------------------
Description changed by sabernhardt:
Old description:
> == 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 feels to be going wrong with `ignore_sticky_posts` behaviour.
>
> === 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/heads/main/wp-query-tester.php
> 2. Create some posts in this order:
> - First 1 sticky post
> - Second 1 not sticky post
> - Third 1 sticky post
> - Fourth 1 not sticky post
>
> 3. Run the plugin in the menu
> 4. 🐞 Bug occurs
>
> === Expected Results
> 1. ✅ According to the docs, sticky should go first
>
> === Actual Results
> 1. ❌ Sticky results and the same as regular results.
>
> === Additional Notes
> This topic is somehow correlated with this issue #63307 just as a
> reference.
>
> === Supplemental Artifacts
> Plugin repo: https://github.com/SirLouen/wp-query-tester/
New description:
== 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
4. Create another post and add the short code `[wp_query_tester]`
5. 🐞 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
- 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,alt="screenshot of
results",title="")]]
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63359#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list