Filters the block templates array before the query takes place.
Description
Return a non-null value to bypass the WordPress queries.
Parameters
$block_templates\WP_Block_Template[]|null
Return an array of block templates to short-circuit the default query, or null to allow WP to run its normal queries.
$queryarray
{ Arguments to retrieve templates. All arguments are optional. @type string[] $slug__in List of slugs to include. @type int $wp_id Post ID of customized template. @type string $area A 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only). @type string $post_type Post type to get the templates for.}
$slug__instring[]
List of slugs to include.
$wp_idint
Post ID of customized template.
$areastring
A 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only).
$post_typestring
Post type to get the templates for.
$template_typestring
Template type. Either 'wp_template' or 'wp_template_part'.
1110* @type int$wp_id Post ID of customized template.1111* @type string$areaA'wp_template_part_area' taxonomy value to filter by(for'wp_template_part' template type only).1112* @type string$post_type Post type to get the templates for.1113*}1114* @param string$template_type Template type. Either 'wp_template'or'wp_template_part'.1115*/1116$templates=apply_filters('pre_get_block_templates',null,$query,$template_type);1117if(!is_null($templates)){1118return$templates;1119}11201121$post_type=isset($query['post_type'])?$query['post_type']:'';1122$wp_query_args=array(
History
Introduced in 5.9.0. Unchanged from 6.7.7 through 7.1.0.