找出默认情况下应显示的编辑器。
原型
wp_default_editor()
描述
找出两个编辑器中的哪一个显示为用户的当前编辑器。 ‘html’设置用于“文本”编辑器选项卡。
返回值
(string)
‘tinymce’,‘html’或’test’
源文件
路径:wp-includes/general-template.php
<?php
...
function wp_default_editor() {
$r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
if ( wp_get_current_user() ) { // look for cookie
$ed = get_user_setting('editor', 'tinymce');
$r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r;
}
/**
* Filters which editor should be displayed by default.
*
* @since 2.5.0
*
* @param string $r Which editor should be displayed by default. Either 'tinymce', 'html', or 'test'.
*/
return apply_filters( 'wp_default_editor', $r );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_default_editor/