pre_get_block_file_template

过滤钩子


apply_filters( 'pre_get_block_file_template', null, $id, $template_type )
参数
  • (WP_Block_Template|null)
    $block_template
    Return block template object to short-circuit the default query,
    or null to allow WP to run its normal queries.
    Required:
  • (string)
    $id
    Template unique identifier (example: theme_slug//template_slug).
    Required:
  • (string)
    $template_type
    Template type: `’wp_template’` or ‘`wp_template_part’`.
    Required:
定义位置
  • wp-includes/block-template-utils.php
    , line 1101
引入
5.9.0
弃用

Filters the block template object before the theme file discovery takes place.

Return a non-null value to bypass the WordPress theme file discovery.

$block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type );