unregister_block_template()
云策文档标注
概述
unregister_block_template() 函数用于取消注册一个块模板,通过模板名称参数操作,返回成功或失败的对象。
关键要点
- 参数 $template_name 为必需字符串,格式为 plugin_uri//template_name
- 返回 WP_Block_Template 对象(成功时)或 WP_Error 对象(失败或模板不存在时)
- 内部调用 WP_Block_Templates_Registry::get_instance()->unregister() 方法实现
- 首次引入于 WordPress 6.7.0 版本
代码示例
function unregister_block_template( $template_name ) {
return WP_Block_Templates_Registry::get_instance()->unregister( $template_name );
}
原文内容
Unregister a block template.
Parameters
$template_namestringrequired-
Template name in the form of
plugin_uri//template_name.
Source
function unregister_block_template( $template_name ) {
return WP_Block_Templates_Registry::get_instance()->unregister( $template_name );
}
Changelog
| Version | Description |
|---|---|
| 6.7.0 | Introduced. |