wppaste
WordPress

add_editor_style( array|string $stylesheet = 'editor-style.css' )

Since
3.0.0
Source
wp-includes/theme.php:2194
Adds callback for custom TinyMCE editor stylesheets.

Description

The parameter $stylesheet is the name of the stylesheet, relative to the theme root. It also accepts an array of stylesheets.It is optional and defaults to 'editor-style.css'. This function automatically adds another stylesheet with -rtl prefix, e.g. editor-style-rtl.css.If that file doesn't exist, it is removed before adding the stylesheet(s) to TinyMCE.If an array of stylesheets is passed to add_editor_style(), RTL is only added for the first stylesheet. Since version 3.4 the TinyMCE body has .rtl CSS class.It is a better option to use that class and add any RTL styles to the main stylesheet.

Parameters

$stylesheetarray|stringoptional
Stylesheet name or array thereof, relative to theme root. Defaults to 'editor-style.css'Default: 'editor-style.css'

Uses · 2

Used by · 13

Show all 13

Source

function add_editor_style( $stylesheet = 'editor-style.css' ) {	global $editor_styles; 	add_theme_support( 'editor-style' ); 	$editor_styles = (array) $editor_styles;	$stylesheet    = (array) $stylesheet; 	if ( is_rtl() ) {		$rtl_stylesheet = str_replace( '.css', '-rtl.css', $stylesheet[0] );		$stylesheet[]   = $rtl_stylesheet;	} 	$editor_styles = array_merge( $editor_styles, $stylesheet );}

History

Introduced in 3.0.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/theme.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.