0

I created a style sheet

editor-style.css

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
2

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

add_editor_style('css/editor-style.css');
  • 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
0

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.