Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Loop: Sticky Post setting doesn't work in Categories #51936

Closed
PHuhn opened this issue Jun 26, 2023 · 5 comments
Closed

Query Loop: Sticky Post setting doesn't work in Categories #51936

PHuhn opened this issue Jun 26, 2023 · 5 comments
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Bug An existing feature does not function as intended

Comments

@PHuhn
Copy link

PHuhn commented Jun 26, 2023

Description

Setting sticky bit on posts with a category show the post as if sticky is not set, that is sorted on the defined Ordered By.

Step-by-step reproduction instructions

Current version: 6.2.2

I have 4 categories, each category has ONE post with the sticky set. I created 4 pages each with a Query Loop with the Inherit query from template turned off, thus setting STICKY POSTS option to Include and Taxonomy of of the appropriate -category-.

On each page I expected the sticky post as the first post, but the posts were sorted on the defined Ordered By, which is Newest to Oldest.

Screenshots, screen recording, code snippet

image

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@ndiego ndiego added the Needs Testing Needs further testing to be confirmed. label Jun 27, 2023
@ndiego ndiego changed the title Sticky Post setting doesn't work in Categories Query Loop: Sticky Post setting doesn't work in Categories Jun 27, 2023
@ndiego ndiego added [Type] Bug An existing feature does not function as intended [Block] Query Loop Affects the Query Loop Block and removed Needs Testing Needs further testing to be confirmed. labels Jun 27, 2023
@ndiego
Copy link
Member

ndiego commented Jun 27, 2023

Thank you for reporting @PHuhn. I have been able to confirm in the latest version of Gutenberg and WordPress 6.2.2.

@PHuhn
Copy link
Author

PHuhn commented Jun 27, 2023

In the years that I have worked with WordPress, I have never used Sticky Post.

It's sad that this is still a problem. I see that the problem has existed for over ten years on Stack Overflow. In this issue over a year ago: 38979, it seems to disappear into a group of loop issues/fixes.

@liviopv
Copy link

liviopv commented Dec 28, 2023

I ran into this recently and it is still reproducible on WordPress 6.4, Gutenberg 17.2+ and TT4.

@ethanclevenger91
Copy link

ethanclevenger91 commented May 11, 2024

Yeah, this actually seems to be "as intended", in a way. The WP_Query class will not load sticky posts if you're not is_home. That should be true in classic themes as well. The query loop block takes no action on the query if you leave the default sticky setting, and that's going to have to change.

I think the "Include" sticky setting needs an explicit value set (right now it's value is empty), and that needs to trigger using post__in in some block logic that currently lives in WordPress core.

@ntsekouras
Copy link
Contributor

ntsekouras commented Oct 25, 2024

As @ethanclevenger91 mentions, this is problem in core. I think we should close this one and and track this there (search for existing trac ticket or create a new one).

@richtabor richtabor closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants