On this page
apply_filters( 'pre_get_block_templates', WP_Block_Template[]|null $block_templates, array $query, string $template_type )
Filters the block templates array before the query takes place.
Description
Return a non-null value to bypass the WordPress queries.
Parameters
$block_templatesWP_Block_Template[]|null-
Return an array of block templates to short-circuit the default query, or null to allow WP to run it's normal queries.
$queryarray-
Arguments to retrieve templates.
slug__inarrayList of slugs to include.wp_idintPost ID of customized template.post_typestringPost type to get the templates for.
$template_typestring-
wp_template or wp_template_part.
Source
File: wp-includes/block-template-utils.php. View all references
$templates = apply_filters( 'pre_get_block_templates', null, $query, $template_type );
Related
Used By
| Used By | Description |
|---|---|
| get_block_templates() wp-includes/block-template-utils.php | Retrieves a list of unified template objects based on a query. |
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/pre_get_block_templates