Opened 4 weeks ago
Last modified 10 days ago
#63359 new defect (bug)
Are ignore_sticky_posts working as expected?
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | major | Version: | |
Component: | Query | Keywords: | needs-patch has-test-info 2nd-opinion |
Focuses: | Cc: |
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
- Install this simple plugin for testing: https://raw.githubusercontent.com/SirLouen/wp-query-tester/refs/heads/main/wp-query-tester.php
- Create some posts in this order:
- First 1 sticky post
- Second 1 not sticky post
- Third 1 sticky post
- Fourth 1 not sticky post
- Run the plugin in the menu
- 🐞 Bug occurs
Expected Results
- ✅ According to the docs, sticky should go first
Actual Results
- ❌ 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/
Change History (7)
#2
in reply to:
↑ 1
@
4 weeks ago
- Keywords 2nd-opinion added
Replying to karthikeya01:
Yes, I can reproduce it. I noticed that this only happens in the admin area — the sticky posts are not displayed at the top there. When I try the same WP_Query on frontend pages, the sticky posts appear at the top as expected.
This might be the intended behavior:
https://github.com/WordPress/wordpress-develop/blob/839c81706ebb2e29c4f70436eb62cec16602d0a7/src/wp-includes/class-wp-query.php#L3563
Very nice spot! Now I can truly reproduce the bug I was willing to reproduce originally, I might close this report, and open a new one to provide the full information and avoid confusions.
Still, I'm not 100% confident that this behavior is ideal (admin-level not being able to reproduce the listings to my requirements). I think that the admin hindrance should be removed.
So I will be leaving this open this for further opinions on this topic.
#3
@
4 weeks ago
PS: If anyone can edit the plugin link (@sabernhardt)
https://raw.githubusercontent.com/SirLouen/wp-query-tester/refs/heads/main/wp-query-tester.php
With this new one:
https://raw.githubusercontent.com/SirLouen/wp-query-tester/refs/tags/1.0.0/wp-query-tester.php
And also I would change the title to
"Stickiness wrong behaviour in Admin pages"
To reflect the new status.
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
3 weeks ago
#7
@
3 weeks ago
@sabernhardt I think it looked the same, but here there are two reports in one.
- One report is related to an admin-level minor priority trouble: why the condition is ignoring sticky in the wp-admin pages.
- The second one, with maximum priority, is the one you merged here wrongly, is about a broken WP Query that is affecting a couple of other issues.
They looked very similar because one helped me find the other (in fact I was looking for the second, but I found this in between). But both must be addressed (specially the second, with the highest priority, it must be punted to 6.8.2)
Can you revert changes and leave them as they were before?
Yes, I can reproduce it. I noticed that this only happens in the admin area — the sticky posts are not displayed at the top there. When I try the same WP_Query on frontend pages, the sticky posts appear at the top as expected.
This might be the intended behavior:
https://github.com/WordPress/wordpress-develop/blob/839c81706ebb2e29c4f70436eb62cec16602d0a7/src/wp-includes/class-wp-query.php#L3563