Hi @stephanr-1 – it sounds like you’re trying to modify what the ‘inherited’ query is – would that be correct?
If so – it’s possible you need to add the filter inside pre_render_block filter as outlined in this doc.
https://developer.ww.wp.xz.cn/block-editor/how-to-guides/block-tutorial/extending-the-query-loop-block/#making-your-custom-query-work-on-the-front-end-side
Thanks for your reply.
In fact, I already use this filter for many occasions, hoping that one day we’ll be able to use almost all of WP_Query()’s functions. More than 10 years ago Justin Tadlock made a very useful widget called “Query Posts”. WordPress has changed since then, and the great Gutenberg editor may simplify the user experience, but it’s still limited when you want to go further in development.
In fact, I wanted to point out that when the ‘Inherit query from template’ checkbox is checked for the “query loop” block, the “build_query_vars_from_query_block” function is not called.
However, it’s in this function that the “query_loop_block_query_vars” filter is called.
That’s a bit problematic, isn’t it?
Sincerely
Stephan
Thanks for the shoutout to my old plugin. 🙂
It may be worth checking out Advanced Query Loop, which is a variation of the core Query Loop block that offers more options. I’m not sure if it’ll handle your specific use case, but it’s definitely worth a try.