[wp-trac] [WordPress Trac] #28557: Add Theme/Plugin-Version to URL not the WP-Version

WordPress Trac noreply at wordpress.org
Mon Jun 16 15:48:46 UTC 2014

#28557: Add Theme/Plugin-Version to URL not the WP-Version
 Reporter:  Drivingralle  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  template      |
 If a theme- or plugin-developer doesn't provide the argument for the
 version number while using any enqueue-function (wp_enqueue_style,
 wp_enqueue_script) WP adds it's own version number to the URLs.

 This leads to the problem:
 A theme is updated, adding new styles including some changes to the
 generated HTML. If WP is not updated at the same time, browser and proxies
 will not re-download the file. This can break layouts because of the lack
 of updated stylesheet.
 The same goes for plugins.
 And if WP is updated all scripts and styles are re-downloaded. Which is
 not required.

 I would like to see the following behavior:
 If the version argument is set, use it.

 No Argument, use the fallback:
 - Styles/scripts enqueued by the theme get the version number of the
 - Styles/scripts enqueued by a plugin get the version number of the
 - Files enqueued by/from core should still use the core version (e.g.

 I use this code in my themes. So there is a variable for the theme

 // Save same data about the theme into a variable
 $my_theme_data = wp_get_theme();

 // Enqueue a CSS style file
     get_stylesheet_directory_uri() . '/style.css',

 To solve:
 - how to detect if theme, plugin or core is enqueuing the file
 - how to get the version number of a plugin
 - what to do if a plugin and a theme or two plugins are enqueued with the
 same handle

 Aside thought on it:
 Adding the version of WP '''and''' the theme to the stylesheet-url or
 maybe a hash of it. Woldn't solve it for plugins ...

Ticket URL: <https://core.trac.wordpress.org/ticket/28557>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list