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

Use an absolute path for the stylesheet:

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

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' );

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.