apply_filters( 'mce_css', string $stylesheets )

Filters the comma-delimited list of stylesheets to load in TinyMCE.


$stylesheets string
Comma-delimited list of stylesheets.

Top ↑

More Information

If you are doing this from within a theme, consider using add_editor_style() instead.

Top ↑


File: wp-includes/class-wp-editor.php. View all references

$mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );

Top ↑


Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 2 content
    Contributed by Steven Lin

    Example Migrated from Codex:

    Add a Google Fonts CSS stylesheet.

    Because mce_css is a comma-separated string of values, you cannot use the default href string from a source like Google Fonts if it contains multiple faces (e.g., ‘,400,700’). You must replace the commas with their URL-encoded equivalent, ‘%2C’.

    add_filter( 'mce_css', 'plugin_mce_css' );
    function plugin_mce_css( $mce_css ) {
    	if ( ! empty( $mce_css ) )
    		$mce_css .= ',';
    	$font_url = ',400,700';
    	$mce_css .= str_replace( ',', '%2C', $font_url );
    	return $mce_css;

You must log in before being able to contribute a note or feedback.