While working on this I noticed a couple of things.
The query_loop_block_query_vars filter’s $block param doesn’t pass the variation itself. So it’s not possible to check 'creativeandrew/single-post-query-loop-selector' === $block->parsed_block['attrs']['namespace']
That might explain why in the documentation it is mentioned the need to have access to the pre_render_block.
I was able to avoid my filter from being applied to other queries by comparing the queryId from the one coming from the
pre_render_block and query_loop_block_query_vars
Closes https://github.com/creative-andrew/single-post-query-loop-selector/issues/1 Check: https://github.com/WordPress/gutenberg/issues/60295
While working on this I noticed a couple of things.
The
query_loop_block_query_vars
filter’s $block param doesn’t pass the variation itself. So it’s not possible to check'creativeandrew/single-post-query-loop-selector' === $block->parsed_block['attrs']['namespace']
That might explain why in the documentation it is mentioned the need to have access to thepre_render_block
. I was able to avoid my filter from being applied to other queries by comparing thequeryId
from the one coming from thepre_render_block
andquery_loop_block_query_vars