Opened 2 months ago
Last modified 4 weeks ago
#62975 new defect (bug)
Twenty Twenty-Five: Exclude sticky posts when offset is used
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 6.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
In Twenty Twenty-Five, there are several templates that use query loop blocks with offsets.
Sticky posts are not hidden by default when offset is used, which means that if a website has sticky posts, they show more than once when the templates are used.
The repeated content is not desired because it is not a good experience for visitors.
See this support request:
https://wordpress.org/support/topic/posts-loop-broken-when-complex-blog-template-used/
This can be solved by updating the query loops that have offsets to also ignore sticky posts.
The "ignore" option is planned to be added in WordPress 6.8. See https://core.trac.wordpress.org/ticket/62908
Another alternative would be to use "exclude" sticky posts, then the sticky would not be repeated, but it would not be shown at all.
Users can also remove the sticky status from their posts. But it is not so easy for users to discover that they can solve the problem that way.
Change History (9)
#3
@
2 months ago
Hi @poena, Thanks for bringing this to Trac!
I have been thinking about this and maybe we can completely remove sticky posts from offset queries, or add a custom filter to dynamically exclude sticky posts only when offset is used.
The former approach is simpler but more restrictive, while the latter offers more flexibility. What are your thoughts on this?
#4
follow-up:
↓ 5
@
2 months ago
Did you mean that the change should be made in the query loop block itself and not in the theme?
I think the expectation is that the behaviour of the query loop should match wp query, where the sticky posts are not removed by the offset.
#5
in reply to:
↑ 4
@
2 months ago
Replying to poena:
Did you mean that the change should be made in the query loop block itself and not in the theme?
Actually, that makes more sense. Perhaps we could restructure affected templates to either split the query (sticky posts + offset posts) or provide alternative templates without offsets?
#7
@
2 months ago
The testing instruction are:
Create a few sticky posts.
Go to Appearance > Editor > Templates
Open a template that uses query loops and has design alternatives.
Select a design that has multiple loops.
Save. View the template on the front of the site.
Update: Actually the
ignore
can't be used because it would cause a block validation error on versions below 6.8. Sigh.