Query block: validate in_the_loop() to true #32896
Labels
[Block] Query Loop
Affects the Query Loop Block
Needs Technical Feedback
Needs testing from a developer perspective.
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
Wanting to filter post links on a classic archive template, I could hook into the post_link filter and then do a in_the_loop() check to make sure to only work on links in the post archive, not in the menu for example.
But The Loop on a block based theme (like block-base) is done with the wp:query block. This loop however, does not set $wp_query->in_the_loop to true. This makes the above example fail on the Query block loop while working on a "regular" loop.
What is your proposed solution?
Make Query block loops behave more like regular loops, starting with $wp_query->in_the_loop :)
The text was updated successfully, but these errors were encountered: