WordPress.org

Make WordPress Core

Ticket #42645: 42645.diff

File 42645.diff, 1.2 KB (added by danieltj, 20 months ago)

Add a version parameter which falls back to wp version

  • wp-includes/theme.php

    diff --git wp-includes/theme.php wp-includes/theme.php
    index 4e5f63b..ec4f60e 100644
    function wp_update_custom_css_post( $css, $args = array() ) { 
    18301830 *
    18311831 * @param array|string $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.
    18321832 *                                     Defaults to 'editor-style.css'
     1833 * @param string       $version    Optional. Add version number to stylesheet URL for cache busting.
    18331834 */
    1834 function add_editor_style( $stylesheet = 'editor-style.css' ) {
     1835function add_editor_style( $stylesheet = 'editor-style.css', $version = '' ) {
    18351836        add_theme_support( 'editor-style' );
    18361837
    18371838        if ( ! is_admin() )
    18381839                return;
    18391840
    18401841        global $editor_styles;
     1842        global $wp_version
     1843
    18411844        $editor_styles = (array) $editor_styles;
    18421845        $stylesheet    = (array) $stylesheet;
     1846        $version       = (array) $version;
     1847
    18431848        if ( is_rtl() ) {
    18441849                $rtl_stylesheet = str_replace('.css', '-rtl.css', $stylesheet[0]);
    18451850                $stylesheet[] = $rtl_stylesheet;
    18461851        }
    18471852
    1848         $editor_styles = array_merge( $editor_styles, $stylesheet );
     1853        if ( '' == $version )
     1854                $version[0] = $wp_version;
     1855
     1856        $editor_styles = array_merge( $editor_styles, $stylesheet, $version );
    18491857}
    18501858
    18511859/**