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.


Top ↑

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.
$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'.

Top ↑

Source

File: wp-includes/block-template-utils.php. View all references

$templates = apply_filters( 'pre_get_block_templates', null, $query, $template_type );


Top ↑

Changelog

Changelog
Version Description
5.9.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.