WordPress

add_editor_style()

Introduction#

The function allows user to load stylesheets for the TinyMCE editor

Syntax#

  • add_editor_style( $stylesheet )

Parameters#

Parameter Details
$ stylesheet (array or string) (Optional) Stylesheet name or array thereof, relative to theme root. Defaults to ‘editor-style.css’
## Loading a single css file
Code
function add_new_style() {
    add_editor_style( 'file-name-here.css' );
}
add_action( 'admin_init', 'add_new_style' );

Explanation

In the above code, we used add_editor_style to load the css file. We also used add_action to make sure that WordPress runs our function.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow