[wp-trac] [WordPress Trac] #56081: Query Loop block with selection causes Sticky Posts setting to be ignored

WordPress Trac noreply at wordpress.org
Mon Jun 27 21:06:32 UTC 2022


#56081: Query Loop block with selection causes Sticky Posts setting to be ignored
--------------------------+-----------------------------
 Reporter:  Starbuck      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  6.0
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56081>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list