wp_editor_expand
云策文档标注
概述
wp_editor_expand 是一个 WordPress 过滤器,用于控制文章编辑器中“展开”功能的启用状态。它允许开发者根据条件(如文章类型)动态调整此功能。
关键要点
- wp_editor_expand 过滤器决定是否启用文章编辑器的“展开”功能。
- 接受两个参数:$expand(布尔值,默认 true)和 $post_type(字符串,表示文章类型)。
- 从 WordPress 4.0.0 版本引入,4.1.0 版本添加了 $post_type 参数。
代码示例
if ( apply_filters( 'wp_editor_expand', true, $post_type ) ) {
原文内容
Filters whether to enable the ‘expand’ functionality in the post editor.
Parameters
$expandbool-
Whether to enable the
'expand'functionality. Default true. $post_typestring-
Post type.
Source
if ( apply_filters( 'wp_editor_expand', true, $post_type ) ) {