钩子文档

block_bindings_supported_attributes_{$block_type}

💡 云策文档标注

概述

此文档介绍了一个 WordPress 过滤器钩子,用于动态过滤特定区块类型中支持块绑定的属性列表。开发者可以利用此钩子自定义哪些区块属性可用于块绑定功能。

关键要点

  • 钩子名称:block_bindings_supported_attributes_{$block_type},其中 $block_type 是动态部分,指代目标区块类型。
  • 参数:$supported_block_attributes,一个字符串数组,表示当前支持的区块属性列表。
  • 用途:允许开发者修改或扩展特定区块类型中可用于块绑定的属性。
  • 相关函数:get_block_bindings_supported_attributes(),用于检索支持块绑定的区块属性列表。
  • 引入版本:WordPress 6.9.0。

代码示例

$supported_block_attributes = apply_filters(
    "block_bindings_supported_attributes_{$block_type}",
    $supported_block_attributes
);

📄 原文内容

Filters the supported block attributes for block bindings.

Description

The dynamic portion of the hook name, $block_type, refers to the block type whose attributes are being filtered.

Parameters

$supported_block_attributesstring[]
The block’s attributes that are supported by block bindings.

Source

$supported_block_attributes = apply_filters(
	"block_bindings_supported_attributes_{$block_type}",
	$supported_block_attributes
);

Changelog

Version Description
6.9.0 Introduced.