WordPressの編集画面画面にeditor-style.cssを追加したかったけど、TinyMCE用とGutenberg用があることで引っかかっていたので覚書。
なお、editor-style.cssは子テーマの中にあるものとします。
Gutenberg用
function my_block_editor_assets() {
wp_enqueue_style(
'my-block-editor-style',
get_stylesheet_directory_uri() . '/editor-style.css',
array(),
filemtime( get_stylesheet_directory() . '/editor-style.css' )
);
}
add_action( 'enqueue_block_editor_assets', 'my_block_editor_assets' );
TinyMCE用
function my_theme_add_editor_styles() {
add_editor_style( 'editor-style.css' );
}
add_action( 'after_setup_theme', 'my_theme_add_editor_styles' );