[wp-trac] [WordPress Trac] #39997: Bundled Themes: Pass theme version number to wp_enqueue_style()

WordPress Trac noreply at wordpress.org
Thu Apr 18 15:49:28 UTC 2019


#39997: Bundled Themes: Pass theme version number to wp_enqueue_style()
-------------------------------------------+-----------------------
 Reporter:  parsmizban                     |       Owner:  desrosj
     Type:  defect (bug)                   |      Status:  reopened
 Priority:  normal                         |   Milestone:  5.2
Component:  Bundled Theme                  |     Version:  4.7.2
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch needs-refresh close  |     Focuses:
-------------------------------------------+-----------------------
Changes (by desrosj):

 * keywords:  has-patch needs-refresh => has-patch needs-refresh close


Comment:

 When a style (or script) is enqueued and a version is not passed, the
 [https://core.trac.wordpress.org/browser/tags/5.1.1/src/wp-includes
 /script-loader.php#L1834 version will always default to the current
 version of WordPress]. The only exception is if `null` is passed as the
 version, then no `ver` argument will be added to the resource URL.

 The default themes do not pass a version to its `wp_enqueue_style()` call,
 so the site's version of WordPress is used.

 I agree with @obenland that if a specific version is important, the child
 theme should enqueue its own stylesheet.

 Based on the audit above, no default `style.css` files actually have a
 version defined when enqueuing. This means that if the theme is updated
 and WordPress is not, the cache will not be busted. @obenland can you see
 any issues with adding a version to these?

 I'm inclined to close this out as the original issue is working as
 expected and open a new ticket to ensure stylesheet versions are accurate.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/39997#comment:39>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list