add_editor_style()

Advertisement

While developing WordPress theme you see the message:

RECOMMENDED: add_editor_style() does not seem to be implemented properly.

The reason is your themes style.css load ONLY ON front end.
So, While writing article end user not have an idea how it looks on front end.


The reason is end user does not

The reason of editor style is to Show the post design / look in post editor window!


Top ↑

# How it editor style works? # How it editor style works?

Check below example to know how editor style works.

E.g. If your single post design is look like below screenshot:

frontend


With editor style support:

with-editor-style

Without editor style support:

without-editor-style


Top ↑

# Add editor style support? # Add editor style support?

/**
 * Added Editor Style
 */
function _theme_slug_setup() {
     add_editor_style( 'editor-style.css' );
}
add_action( 'after_setup_theme', '_theme_slug_setup' );

Top ↑

# Add RTL Support for Editor Style # Add RTL Support for Editor Style

For editor style RTL support! Save the file with FILE_NAME-rtl.css

E.g. editor-style.css then editor-style-rtl.css
E.g. assets/inc/editor-style.css then assets/inc/editor-style-rtl.css

Leave a Reply