I created a style sheet


I want to load this css file using add_editor_style() function,

In my functions.php

function my_theme_add_editor_styles() {
    add_editor_style( 'css/editor-style.css' );
add_action( 'after_setup_theme', 'my_theme_add_editor_styles' );

I also tried this solution

add_editor_style is not loading in frontend. Any solution?

  • Why does the file have two .css extensions? – jetlej Jan 10 '15 at 19:09

You shouldn't need an action to add an editor style. Simple add the following anywhere in your functions.php:

  • Thanks much! The WordPress Codex suggests to do it the way @Relax tried. Removing the function and action stuff worked great. – ps2goat Jun 16 '15 at 5:42

You need to do two things (see additional add_theme_support):

add_theme_support( 'editor-styles' );
add_action('admin_init', 'el_add_editor_styles');

function el_add_editor_styles() {
    add_editor_style( 'style-editor.css' );
  • sadly, this is the only answer that actually works. should be at the top and upvoted. – Ivan Hanák Jul 8 '20 at 12:42
  • The reason their example is broken is that add_editor_style calls add_theme_support( 'editor-styles' ); for you, but admin_init is too late to declare theme supports. So they should really recommend add_editor_style be hooked earlier, like after_setup_theme or something. – Ethan C Sep 16 '20 at 3:40

Use an absolute path for the stylesheet:

add_editor_style( get_template_directory_uri() . '/css/editor-style.css' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.