函数原型
register_block_style( string $block_name, array $style_properties ): bool
函数描述
Registers a new block style.
是否弃用
未弃用
函数参数
-
$block_name
string
Required - Block type name including namespace.
-
$style_properties
array
Required - Array containing the properties of the style name, label, style (name of the stylesheet to be enqueued), inline_style (string containing the CSS to be added).
函数返回值
bool True if the block style was registered with success and false otherwise.
函数位置
File: wp-includes/blocks.php.
函数源码
function register_block_style( $block_name, $style_properties ) {
return WP_Block_Styles_Registry::get_instance()->register( $block_name, $style_properties );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |

