replace_editor
云策文档标注
概述
replace_editor 是一个 WordPress 过滤器钩子,允许开发者替换默认的编辑器。它接受一个布尔值参数来控制是否替换编辑器,并关联一个 WP_Post 对象。
关键要点
- 这是一个过滤器钩子,用于控制编辑器的替换行为。
- 参数包括一个布尔值(默认 false)和一个 WP_Post 对象。
- 在 WordPress 4.9.0 版本中引入。
代码示例
if ( true === apply_filters( 'replace_editor', false, $post ) ) {注意事项
使用时需确保正确处理 $post 参数,以避免编辑器替换错误。
原文内容
Allows replacement of the editor.
Parameters
$replacebool-
Whether to replace the editor. Default false.
$postWP_Post-
Post object.
Source
if ( true === apply_filters( 'replace_editor', false, $post ) ) {
Changelog
| Version | Description |
|---|---|
| 4.9.0 | Introduced. |