钩子文档

use_widgets_block_editor

💡 云策文档标注

概述

use_widgets_block_editor 是一个 WordPress 过滤器,用于控制是否使用块编辑器来管理小部件。它基于主题支持设置,允许开发者自定义小部件编辑器的使用方式。

关键要点

  • 这是一个过滤器,用于决定是否启用块编辑器来管理小部件。
  • 参数 $use_widgets_block_editor 是一个布尔值,表示是否使用块编辑器。
  • 默认值来自 get_theme_support('widgets-block-editor'),开发者可以通过此过滤器覆盖。
  • 相关函数 wp_use_widgets_block_editor() 用于确定是否使用块编辑器。
  • 此过滤器在 WordPress 5.8.0 版本中引入。

代码示例

return apply_filters(
    'use_widgets_block_editor',
    get_theme_support( 'widgets-block-editor' )
);

📄 原文内容

Filters whether to use the block editor to manage widgets.

Parameters

$use_widgets_block_editorbool
Whether to use the block editor to manage widgets.

Source

return apply_filters(
	'use_widgets_block_editor',
	get_theme_support( 'widgets-block-editor' )
);

Changelog

Version Description
5.8.0 Introduced.