#46979 closed defect (bug) (fixed)
Bundled themes should pass version to wp_enqueue_style() to ensure proper cache busting
Reported by: | dswebsme | Owned by: | dswebsme |
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Bundled Theme | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description (last modified by )
Bundled themes should pass the current theme version ($ver
parameter) to wp_enqueue_style()
to ensure theme stylesheets properly bypass cache after being updated.
Dev discussion on the subject took place here: #39997
This affects themes twentyten
- twentyseventeen
. Bundled theme twentynineteen
already passes a dynamic $ver
parameter.
Key details provided by @desrosj
I audited the stylesheet last edit dates and the version specified in the wp_enqueue_style()
call. Let's leave Twenty Nineteen alone (that was already calling wp_get_theme()->get( 'Version' )
, and make sure the dates are correct (and actually present) for each stylesheet. Results (dates in YYYY-MM-DD):
Last Modified | Current Specified Version | |
---|---|---|
Twenty Ten | ||
blocks.css | 2018-12-18 | 20181018 *
|
editor-blocks.css | 2018-12-18 | none |
style.css | 2019-02-07 | none |
Twenty Eleven | ||
blocks.css | 2019-01-02 | 20181230 *
|
editor-blocks.css | 2019-01-02 | 20181230 *
|
style.css | 2019-04-04 | none |
/inc/theme-options.css | 2011-06-02 | 2011-04-28 *
|
/colors/dark.css | 2019-04-04 | null
|
Twenty Twelve | ||
style.css | 2019-04-06 | none |
/css/blocks.css | 2019-04-06 | 20181230 *
|
/css/ie.css | 2015-02-14 | 20121010 *
|
/css/editor-blocks.css | 2019-04-06 | 20181230 *
|
Twenty Thirteen | ||
style.css | 2019-02-07 | 2013-07-18 *
|
/css/blocks.css | 2019-01-02 | 2018-12-30 *
|
/css/ie.css | 2015-02-14 | 2013-07-18 *
|
/css/editor-blocks.css | 2019-01-02 | 2018-12-30 *
|
Twenty Fourteen | ||
style.css | 2019-02-07 | none |
/css/blocks.css | 2019-01-02 | 20181230 *
|
/css/ie/css | 2014-07-01 | 20131205 *
|
/css/editor-blocks.css | 2019-01-02 | 20181230 *
|
Twenty Fifteen | ||
style.css | 2019-04-02 | none |
/css/blocks.css | 2019-01-02 | 20181230 *
|
/css/ie.css | 2017-09-16 | 20141010 *
|
/css/ie7.css | 2014-12-10 | 20141010 *
|
css/edtior-blocks.css | 2019-01-02 | 20181230 *
|
Twenty Sixteen | ||
style.css | 2019-02-07 | none |
/css/blocks.css | 2019-01-02 | 20181230 *
|
/css/ie8.css | 2017-05-30 | 20160816 *
|
/css/ie7.css | 2017-05-30 | 20160816 *
|
/css/editor-blocks.css | 2019-01-02 | 20181230 *
|
Twenty Seventeen | ||
style.css | 2019-04-08 | none |
/assets/css/blocks.css | 2019-01-05 | 1.1
|
/assets/css/colors-dark.css | 2019-04-08 | 1.0
|
/assets/css/ie9.css | 2016-12-02 | 1.0
|
/assets/css/ie8.css | 2016-12-02 | 1.0
|
/assets/css/editor-blocks.css | 2019-03-28 | 1.1
|
Added during DEV
Twenty Sixteen | ||
---|---|---|
/css/ie.css | 2017-05-30 | 20160816 *
|
Attachments (2)
Change History (16)
#3
in reply to:
↑ 1
@
5 years ago
Replying to afercia:
Thanks! I was just about to correct my markdown.
#4
@
5 years ago
- Description modified (diff)
- Owner set to dswebsme
- Status changed from new to accepted
#6
@
5 years ago
- Keywords has-patch needs-testing added; needs-patch removed
Patch attached.
This patch addresses stylesheet version issues originally reported by @desrosj in bundled themes twentyten
- twentyseventeen
. The following improvements are included:
- applies
YYYYMMDD
formatted version to stylesheets previously loaded without a version - updates outdated file versions based on last modified date in the repository
- corrects version strings to match the preferred format of
YYYYMMDD
Tapping @obenland and @ianbelanger as developers involved in the original discussion.
#7
@
5 years ago
If there's a child theme, this won't work.
This is because the main stylesheet enqueued in parent functions.php is the child stylesheet.
The last modified date of the file is user dependent.
#8
@
5 years ago
@superpoincare This is not meant to be a solution for child themes. As discussed in #39997, child themes with specific versioning requirements should be enqueueing stylesheets with their own custom version strings.
Specifically @obenland summed up our discussion here: https://core.trac.wordpress.org/ticket/39997#comment:37
#10
@
5 years ago
- Milestone changed from 5.2.1 to 5.3
- Version 5.1.1 deleted
Changing milestone as Bundled Themes
are only updated during major
releases. Also removed version 5.1.1
as this was not introduced in that version.
#11
@
5 years ago
- Keywords needs-refresh added
Since the release of 5.2
each themes style.css
has been updated, so I am updating the table of Theme versions and will be updating the patch with the new dates.
Last Modified | Current Specified Version | |
---|---|---|
Twenty Ten | ||
blocks.css | 2018-12-18 | 20181018 *
|
editor-blocks.css | 2018-12-18 | none |
style.css | 2019-05-07 | none |
Twenty Eleven | ||
blocks.css | 2019-01-02 | 20181230 *
|
editor-blocks.css | 2019-01-02 | 20181230 *
|
style.css | 2019-05-07 | none |
/inc/theme-options.css | 2011-06-02 | 2011-04-28 *
|
/colors/dark.css | 2019-04-04 | null *
|
Twenty Twelve | ||
style.css | 2019-05-07 | none |
/css/blocks.css | 2019-04-06 | 20181230 *
|
/css/ie.css | 2015-02-14 | 20121010 *
|
/css/editor-blocks.css | 2019-04-06 | 20181230 *
|
Twenty Thirteen | ||
style.css | 2019-05-07 | 2013-07-18 *
|
/css/blocks.css | 2019-01-02 | 2018-12-30 *
|
/css/ie.css | 2015-02-14 | 2013-07-18 *
|
/css/editor-blocks.css | 2019-01-02 | 2018-12-30 *
|
Twenty Fourteen | ||
style.css | 2019-05-07 | none |
/css/blocks.css | 2019-01-02 | 20181230 *
|
/css/ie/css | 2014-07-01 | 20131205 *
|
/css/editor-blocks.css | 2019-01-02 | 20181230 *
|
Twenty Fifteen | ||
style.css | 2019-05-07 | none |
/css/blocks.css | 2019-01-02 | 20181230 *
|
/css/ie.css | 2017-09-16 | 20141010 *
|
/css/ie7.css | 2014-12-10 | 20141010 *
|
css/edtior-blocks.css | 2019-01-02 | 20181230 *
|
Twenty Sixteen | ||
style.css | 2019-05-07 | none |
/css/blocks.css | 2019-01-02 | 20181230 *
|
/css/ie8.css | 2017-05-30 | 20160816 *
|
/css/ie7.css | 2017-05-30 | 20160816 *
|
/css/editor-blocks.css | 2019-01-02 | 20181230 *
|
Twenty Seventeen | ||
style.css | 2019-05-07 | none |
/assets/css/blocks.css | 2019-01-05 | 1.1
|
/assets/css/colors-dark.css | 2019-04-08 | 1.0
|
/assets/css/ie9.css | 2016-12-02 | 1.0
|
/assets/css/ie8.css | 2016-12-02 | 1.0
|
/assets/css/editor-blocks.css | 2019-03-28 | 1.1
|
Replying to afercia: