Title: get_block_templates
Published: February 3, 2022
Last modified: May 20, 2026

---

# apply_filters( ‘get_block_templates’, WP_Block_Template[] $query_result, array $query, string $template_type )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#wp--skip-link--target)

Filters the array of queried block templates array after they’ve been fetched.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#parameters)󠁿

 `$query_result`[WP_Block_Template](https://developer.wordpress.org/reference/classes/wp_block_template/)[]

Array of found block templates.

`$query`array

Arguments to retrieve templates. All arguments are optional.

 * `slug__in` string[]
 * List of slugs to include.
 * `wp_id` int
 * Post ID of customized template.
 * `area` string
 * A `'wp_template_part_area'` taxonomy value to filter by (for `'wp_template_part'`
   template type only).
 * `post_type` string
 * Post type to get the templates for.

`$template_type`string

wp_template or wp_template_part.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'get_block_templates', $query_result, $query, $template_type );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/block-template-utils.php#L1275)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/block-template-utils.php#L1275-L1275)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#related)󠁿

| Used by | Description | 
| [get_block_templates()](https://developer.wordpress.org/reference/functions/get_block_templates/)`wp-includes/block-template-utils.php` |

Retrieves a list of unified template objects based on a query.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/get_block_templates/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fget_block_templates%2F)
before being able to contribute a note or feedback.