get_block_type_uses_context
云策文档标注
概述
get_block_type_uses_context 是一个 WordPress 过滤器,用于修改块类型注册的 uses context 数组。它允许开发者在获取块类型的 uses context 时进行自定义调整。
关键要点
- 过滤器名称:get_block_type_uses_context
- 参数:$uses_context(字符串数组,块类型的注册 uses context)和 $block_type(WP_Block_Type 对象,完整的块类型对象)
- 用途:过滤块类型的 uses context,常用于扩展或修改块的行为
- 相关函数:WP_Block_Type::get_uses_context()
- 引入版本:WordPress 6.5.0
代码示例
return apply_filters( 'get_block_type_uses_context', $this->uses_context, $this );
原文内容
Filters the registered uses context for a block type.
Parameters
$uses_contextstring[]-
Array of registered uses context for a block type.
$block_typeWP_Block_Type-
The full block type object.
Source
return apply_filters( 'get_block_type_uses_context', $this->uses_context, $this );
Changelog
| Version | Description |
|---|---|
| 6.5.0 | Introduced. |