添加自定义TinyMCE编辑器样式表的回调。
原型
add_editor_style( array|string $stylesheet = 'editor-style.css' )
描述
参数$ stylesheet是样式表的名称,相对于主题根。它还接受一系列样式表。它是可选的,默认为’editor-style.css’。
参数
$stylesheet
(array|string)
(Optional)
样式表名称或其数组,相对于主题根。默认为’editor-style.css’
源文件
路径:wp-includes/theme.php
<?php
...
function add_editor_style( $stylesheet = 'editor-style.css' ) {
add_theme_support( 'editor-style' );
if ( ! is_admin() )
return;
global $editor_styles;
$editor_styles = (array) $editor_styles;
$stylesheet = (array) $stylesheet;
if ( is_rtl() ) {
$rtl_stylesheet = str_replace('.css', '-rtl.css', $stylesheet[0]);
$stylesheet[] = $rtl_stylesheet;
}
$editor_styles = array_merge( $editor_styles, $stylesheet );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/add_editor_style/