Make WordPress Core


Ignore:
Timestamp:
04/16/2019 02:55:48 PM (5 years ago)
Author:
desrosj
Message:

Bundled Themes: Use the theme version when enqueuing theme specific stylesheets.

For many bundled theme related stylesheets, a version is either not specified, or specified as a hardcoded date string when enqueued. This is problematic when a stylesheet is updated and the version number is not (which has happened several times recently). This change ensures that all bundled theme related stylesheets use the theme’s version as the stylesheet version. This ensures cache busting for theme stylesheets every time a theme is updated and guarantees that users receive any new or updated styles included in the update when visiting the site for the first time after an update.

Props parsmizban, ianbelanger, dswebsme.
Fixes #39997.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/inc/theme-options.php

    r45140 r45213  
    1818 */
    1919function twentyeleven_admin_enqueue_scripts( $hook_suffix ) {
    20     wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
     20    wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, wp_get_theme()->get( 'Version' ) );
    2121    wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' );
    2222    wp_enqueue_style( 'farbtastic' );
     
    408408
    409409    if ( 'dark' == $color_scheme ) {
    410         wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null );
     410        wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), wp_get_theme()->get( 'Version' ) );
    411411    }
    412412
Note: See TracChangeset for help on using the changeset viewer.