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:
定義位置
相關勾子
get_block_file_templatepre_get_block_templatepre_get_block_templatesget_block_templateget_block_templates
相關方法
get_block_file_templateget_block_templateget_block_templates_get_block_template_fileresolve_block_template_get_block_templates_files
引入
5.9.0
棄用
-

pre_get_block_file_template是一個過濾鉤子,允許你在WordPress檢索和使用一個塊的模板之前修改它的檔案路徑。

在發現主題檔案之前,對區塊模板物件進行過濾。

返回一個非空值以繞過WordPress主題檔案的發現。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type );
$block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type );
$block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type );

常見問題

FAQs
檢視更多 >