• Are you sure that the ‘query_loop_block_query_vars’ filter is called by the ‘Query Loop’ block when the ‘Inherit query from template’ option is checked?

    I’m afraid not, and this removes the whole point of the filter.

    Do you have an alternative?

    Thanks

    Stephan

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator jordesign

    (@jordesign)

    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.www.ads-software.com/block-editor/how-to-guides/block-tutorial/extending-the-query-loop-block/#making-your-custom-query-work-on-the-front-end-side

    Thread Starter StephanR

    (@stephanr-1)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Query Loop : ‘query_loop_block_query_vars’ filter not call?’ is closed to new replies.