钩子文档

wp_editor_settings

💡 云策文档标注

概述

wp_editor_settings 是一个 WordPress 过滤器,用于修改 wp_editor() 函数的设置参数。它允许开发者自定义编辑器实例的配置,包括在块编辑器的 Classic 块中。

关键要点

  • 过滤器名称:wp_editor_settings,用于过滤 wp_editor() 的设置数组。
  • 参数:$settings(数组,编辑器参数)和 $editor_id(字符串,编辑器唯一标识符,如 'content' 或 'classic-block')。
  • 相关函数:参考 _WP_Editors::parse_settings() 解析默认设置。
  • 版本历史:自 WordPress 4.0.0 引入。

代码示例

$settings = apply_filters( 'wp_editor_settings', $settings, $editor_id );

📄 原文内容

Filters the wp_editor() settings.

Description

See also

Parameters

$settingsarray
Array of editor arguments.
$editor_idstring
Unique editor identifier, e.g. 'content'. Accepts 'classic-block' when called from block editor’s Classic block.

Source

$settings = apply_filters( 'wp_editor_settings', $settings, $editor_id );

Changelog

Version Description
4.0.0 Introduced.