apply_filters( 'query_loop_block_query_vars', array $query, WP_Block $block, int $page )
- Since
- 6.1.0
WP_Query for the Query Loop Block.Description
Anything to this filter should be compatible with the WP_Query API to form the query context which will be passed down to the Query Loop Block's children.
This can help, for example, to include additional settings or meta queries not directly supported by the core Query Loop Block, and extend its capabilities.
Please note that this will only influence the query that will be rendered on the front-end. The editor preview is not affected by this filter. Also, worth noting that the editor preview uses the REST API, so, ideally, one should aim to provide attributes which are also compatible with the REST API, in order to be able to implement identical queries on both sides.
Compatibility
- WordPress
- since 6.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$queryarray- Array containing parameters for
WP_Queryas parsed by the block context. $blockWP_Block- Block instance.
$pageint- Current query's page.
Where this hook fires · 1
wp-includes/blocks.php:3071build_query_vars_from_query_block()
Source code
<?php * @since 6.1.0 * * @param array $query Array containing parameters for `WP_Query` as parsed by the block context. * @param WP_Block $block Block instance. * @param int $page Current query's page. */ return apply_filters( 'query_loop_block_query_vars', $query, $block, $page );} /** * Helper function that returns the proper pagination arrow HTML for * `QueryPaginationNext` and `QueryPaginationPrevious` blocks based * on the provided `paginationArrow` from `QueryPagination` context.Changelog
Introduced in 6.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.