钩子文档

block_bindings_supported_attributes

💡 云策文档标注

概述

本文档介绍 WordPress 6.9.0 引入的 block_bindings_supported_attributes 过滤器,用于过滤块绑定支持的块属性。开发者可以通过此过滤器自定义特定块类型支持的属性列表。

关键要点

  • block_bindings_supported_attributes 是一个过滤器,允许修改块绑定支持的块属性数组。
  • 过滤器接收两个参数:$supported_block_attributes(支持的属性数组)和 $block_type(块类型字符串)。
  • 此过滤器与 get_block_bindings_supported_attributes() 函数相关,用于检索块绑定支持的属性列表。

代码示例

$supported_block_attributes = apply_filters(
    'block_bindings_supported_attributes',
    $supported_block_attributes,
    $block_type
);

📄 原文内容

Filters the supported block attributes for block bindings.

Parameters

$supported_block_attributesstring[]
The block’s attributes that are supported by block bindings.
$block_typestring
The block type whose attributes are being filtered.

Source

$supported_block_attributes = apply_filters(
	'block_bindings_supported_attributes',
	$supported_block_attributes,
	$block_type
);

Changelog

Version Description
6.9.0 Introduced.