apply_filters( 'get_block_templates', \WP_Block_Template[] $query_result, array $query, string $template_type )
- Since
- 5.9.0
Filters the array of queried block templates array after they've been fetched.
Compatibility
- WordPress
- since 5.9.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
$query_result\WP_Block_Template[]- Array of found block templates.
$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_idintPost ID of customized template.$areastringA 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only).$post_typestringPost type to get the templates for.
$template_typestring- wp_template or wp_template_part.
Where this hook fires · 1
wp-includes/block-template-utils.php:1210get_block_templates()
Source code
* @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. * } * @param string $template_type wp_template or wp_template_part. */ return apply_filters( 'get_block_templates', $query_result, $query, $template_type );} /** * Retrieves a single unified template object using its id. * * @since 5.8.0Changelog
Introduced in 5.9.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 6.7.7 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.