Make WordPress Core

Opened 3 years ago

#56081 new defect (bug)

Query Loop block with selection causes Sticky Posts setting to be ignored

Reported by: starbuck's profile Starbuck Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.0
Component: Query Keywords:
Focuses: Cc:

Description

The Query Loop has an option to "Inherit query from template". There is another option to display Sticky posts - only, include, or exclude. On an Archive page where a query has pre-selected taxonomy, the sticky selector is ignored. So, where Inherit Query is checked, it doesn't matter if Sticky Posts is set to Include, Exclude, or Only - stickies and non-stickies are both always shown. The correct selection is shown in the template editor, but not when rendering an archive page from the front-end.

To test: I am getting my stickies up top and everything following by using two query loops in the default Home page that displays all blog posts.

In the Home template: This page is <strong>not</strong> filtered. The first query loop has Inherit Query unchecked, and Sticky Posts set to Include. The second query loop has Inherit Query unchecked, and Sticky Posts set to EXclude. So there are two loops, one for stickies, and the next for all others. This results here are as expecteed.

To achieve the same results as above for the Archive template, which <strong>is</strong> filtered. The two query loops would be set the same as above, except with Inherit Query checked in both. But the result is not as expected.

Let's try a simpler version for the Archive. One Query Loop has Inherit Query checked, and Sticky Posts set to Exclude or Only. The Sticky setting is ignored and all pre-selected posts are rendered in the archive page with stickies and non-stickies mixed. Again, it looks OK on the back-end, not on the front-end.

Desired behavior: The Sticky setting and anything else that can be configured for a Query Loop should be included in the query at run-time.

Notes:

  • This might be specific to the Twenty TwentyTwo theme.
  • I have not checked to see if the behavior is the same with the classic loop, without blocks, with PHP templates rather than HTML templates.

Change History (0)

Note: See TracTickets for help on using tickets.