函数文档

get_block_bindings_source()

💡 云策文档标注

概述

get_block_bindings_source() 函数用于检索已注册的块绑定源。它接受源名称作为参数,返回对应的 WP_Block_Bindings_Source 对象或 null。

关键要点

  • 参数 $source_name(字符串,必需):指定要检索的源名称。
  • 返回值:WP_Block_Bindings_Source|null,返回已注册的块绑定源,如果未注册则返回 null。
  • 内部实现:通过 WP_Block_Bindings_Registry::get_instance()->get_registered($source_name) 调用。
  • 引入版本:WordPress 6.5.0。

代码示例

Source function get_block_bindings_source( string $source_name ) {
	return WP_Block_Bindings_Registry::get_instance()->get_registered( $source_name );
}

📄 原文内容

Retrieves a registered block bindings source.

Parameters

$source_namestringrequired
The name of the source.

Return

WP_Block_Bindings_Source|null The registered block bindings source, or null if it is not registered.

Source

function get_block_bindings_source( string $source_name ) {
	return WP_Block_Bindings_Registry::get_instance()->get_registered( $source_name );
}

Changelog

Version Description
6.5.0 Introduced.