函数文档

block_core_image_ensure_interactivity_dependency()

💡 云策文档标注

概述

此函数用于确保视图脚本具有 wp-interactivity 依赖,但已在 WordPress 6.5.0 版本中被弃用,建议使用 wp_register_script_module 替代。

关键要点

  • 函数 block_core_image_ensure_interactivity_dependency() 的主要作用是确保视图脚本包含 wp-interactivity 依赖
  • 该函数在 WordPress 6.5.0 版本中被标记为弃用,推荐使用 wp_register_script_module 函数作为替代方案
  • 函数最初在 WordPress 6.4.0 版本中引入,并在 6.5.0 版本中弃用

注意事项

  • 开发者应避免在新代码中使用此函数,转而使用 wp_register_script_module 来管理脚本依赖
  • 使用此函数会触发 _deprecated_function() 警告,提示其已弃用

📄 原文内容

Ensures that the view script has the wp-interactivity dependency.

Source

function block_core_image_ensure_interactivity_dependency() {
	_deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
}

Changelog

Version Description
6.5.0 Deprecated.
6.4.0 Introduced.