WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a method to force the refresh of editor-style.css, when I change manually the stylesheet for the TinyMCE editor? Modification doesn't show immediately but they will be cached in the admin side of administration backend.

For example like this:

share|improve this question
If it's for your development purposes why not just do a hard refresh in the browser or turn the browser cache off? – sanchothefat Nov 10 '11 at 10:30
I've had the same problem, and a hard refresh doesn't always work. The caching seems to be pretty stubborn. – Ray Gulick Nov 15 '11 at 18:52
up vote 7 down vote accepted

There is a hook for that: 'mce_css'. It is called in _WP_Editors::editor_settings() and you get all loaded stylesheets comma separated as the first and only parameter.

Now it is easy: Use the global variable $editor_styles (here are your theme’s and parent theme’s editor stylesheets stored already), add the time of the file’s last modification as a parameter and rebuild the string.

As a plugin:

<?php # -*- coding: utf-8 -*-
 * Plugin Name: T5 Fresh Editor Stylesheets
 * Description: Enforces fresh editor stylesheets per version parameter.
 * Version:     2012.07.21
 * Author:      Thomas Scholz
 * Plugin URI:  http://wordpress.stackexchange.com/q/33318/73
 * Author URI:  http://toscho.de
 * License:     MIT
 * License URI: http://www.opensource.org/licenses/mit-license.php

if ( ! function_exists( 't5_fresh_editor_style' ) )
    add_filter( 'mce_css', 't5_fresh_editor_style' );

     * Adds a parameter of the last modified time to all editor stylesheets.
     * @wp-hook mce_css
     * @param  string $css Comma separated stylesheet URIs
     * @return string
    function t5_fresh_editor_style( $css )
        global $editor_styles;

        if ( empty ( $css ) or empty ( $editor_styles ) )
            return $css;

        // Modified copy of _WP_Editors::editor_settings()
        $mce_css   = array();
        $style_uri = get_stylesheet_directory_uri();
        $style_dir = get_stylesheet_directory();

        if ( is_child_theme() )
            $template_uri = get_template_directory_uri();
            $template_dir = get_template_directory();

            foreach ( $editor_styles as $key => $file )
                if ( $file && file_exists( "$template_dir/$file" ) )
                    $mce_css[] = add_query_arg(
                        filemtime( "$template_dir/$file" ),

        foreach ( $editor_styles as $file )
            if ( $file && file_exists( "$style_dir/$file" ) )
                $mce_css[] = add_query_arg(
                    filemtime( "$style_dir/$file" ),

        return implode( ',', $mce_css );
share|improve this answer
In WordPress 3.9 this plugin now seems to break the image editing buttons. I haven't had a chance to try to figure out why. – mrwweb Jun 17 '14 at 16:08

I had the same issue (2012, WP 3.4.2 !!). Possible solutions while this bug is around:

1) If you use firebug, [x]Disable Browser Cache in the Net panel helps. I even had a very strange issue, that the cached editor-style briefly appears (in a css-filtered) Firebug net panel for a split second, than disappears again. Took screenshots to prove to myself.

2) A full browser cache clear helps. For whatever reason thereafter the issue did not reappear.

3) Lastly, my preferred advice, if you have to also make sure, i.e. your clients on staging or live server get your incremental improvements (w/o any annoying cache clearance advice):

Relocate the file and keep counting up:

// add_editor_style('editor-style-01.css'); bump for every deployment
// add_editor_style('editor-style-02.css');

Hacky, but reliable.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.