wpseek.com
A WordPress-centric search engine for devs and theme authors



pre_get_block_templates › WordPress Filter Hooks

Since5.9
Deprecatedn/a
apply_filters( 'pre_get_block_templates', null, $query, $template_type )
Parameters: (3)
  • (WP_Block_Template[]|null) $block_templates Return an array of block templates to short-circuit the default query, or null to allow WP to run it's normal queries.
    Required: Yes
  • (array) $query { Optional. Arguments to retrieve templates. @type array $slug__in List of slugs to include. @type int $wp_id Post ID of customized template. @type string $post_type Post type to get the templates for. }
    Required: Yes
  • (array) $template_type wp_template or wp_template_part.
    Required: Yes
Defined at:
Codex:

Filters the block templates array before the query takes place.

Return a non-null value to bypass the WordPress queries.





Source

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