revision_text_diff_options
云策文档标注
概述
revision_text_diff_options 过滤器用于在查看文章修订时,修改传递给 wp_text_diff() 函数的选项参数。它允许开发者自定义文本差异比较的显示方式,如视图布局和标题设置。
关键要点
- 过滤器名称:revision_text_diff_options
- 主要功能:过滤 wp_text_diff() 的选项数组,影响修订比较的渲染
- 参数:$args(选项数组)、$field(当前修订字段)、$compare_from(源修订文章)、$compare_to(目标修订文章)
- 选项示例:show_split_view 控制是否显示分栏视图,默认 true
- 引入版本:WordPress 4.1.0
代码示例
$args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to );
原文内容
Filters revisions text diff options.
Description
Filters the options passed to wp_text_diff() when viewing a post revision.
Parameters
$argsarray-
Associative array of options to pass to wp_text_diff() .
show_split_viewboolTrue for split view (two columns), false for un-split view (single column). Default true.
More Arguments from wp_text_diff( … $args )
Associative array of options to pass to WP_Text_Diff_Renderer_Table().
titlestringTitles the diff in a manner compatible with the output.title_leftstringChange the HTML to the left of the title.title_rightstringChange the HTML to the right of the title.show_split_viewboolTrue for split view (two columns), false for un-split view (single column). Default true.
$fieldstring-
The current revision field.
$compare_fromWP_Post-
The revision post to compare from.
$compare_toWP_Post-
The revision post to compare to.
Source
$args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to );
Changelog
| Version | Description |
|---|---|
| 4.1.0 | Introduced. |