函数文档

wp_setup_widgets_block_editor()

💡 云策文档标注

概述

wp_setup_widgets_block_editor() 是一个 WordPress 函数,用于启用小工具块编辑器。它通过钩子 'after_setup_theme' 集成,默认启用块编辑器,但主题可以禁用此功能。

关键要点

  • 函数 wp_setup_widgets_block_editor() 调用 add_theme_support('widgets-block-editor') 来注册主题对小工具块编辑器的支持。
  • 此函数在 WordPress 5.8.0 版本中引入,作为启用块编辑器默认行为的一部分。
  • 主题可以通过不调用此函数或移除相关钩子来禁用小工具块编辑器。

📄 原文内容

Enables the widgets block editor. This is hooked into ‘after_setup_theme’ so that the block editor is enabled by default but can be disabled by themes.

Source

function wp_setup_widgets_block_editor() {
	add_theme_support( 'widgets-block-editor' );
}

Changelog

Version Description
5.8.0 Introduced.