apply_filters( 'mce_css', string $stylesheets )

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


Parameters Parameters

$stylesheets

(string) Comma-delimited list of stylesheets.


Top ↑

More Information More Information

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


Top ↑

Source Source

File: wp-includes/class-wp-editor.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 2 content
    Contributed by stevenlinx

    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., ‘http://fonts.googleapis.com/css?family=Lato:300,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 = 'http://fonts.googleapis.com/css?family=Lato:300,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.