钩子文档

the_editor_content

💡 云策文档标注

概述

the_editor_content 是一个 WordPress 过滤器钩子,用于过滤默认编辑器内容。它允许开发者修改编辑器初始化时显示的内容。

关键要点

  • 钩子名称:the_editor_content
  • 参数:$content(默认编辑器内容字符串)和 $default_editor(当前用户的默认编辑器类型,如 'html' 或 'tinymce')
  • 用途:在编辑器输出前过滤内容,常用于自定义编辑器行为或内容预处理
  • 相关函数:WP_Widget_Text::form() 和 _WP_Editors::editor() 使用此钩子
  • 版本历史:自 WordPress 2.1.0 引入

📄 原文内容

Filters the default editor content.

Parameters

$contentstring
Default editor content.
$default_editorstring
The default editor for the current user.
Either 'html' or 'tinymce'.

Source

$content = apply_filters( 'the_editor_content', $content, $default_editor );

Changelog

Version Description
2.1.0 Introduced.