Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make version query parameter optional
When registering a Stylesheet or Script (register_style, register_script functions), can the "v=" query string be omitted from the generated html if the version parameter is blank or otherwise not provided?

Apparently, while successfully cache busting, it can block caching completely:

I prefer automatically embedding the file date into the name, then use .htaccess to remove it when requested as per html5-boilerplate's and others advice. This can be be done conveniently with a small .htaccess file in the template folder.

Example from my template functions.php:
register_style(TEMPLATE . '.site', self::autoVer($theme_url . '/css/theme.min.css'), '', 'all');
 Generates something like:
<link href="/theme/mytheme.2018/css/theme.min.1527149955.css?v=" rel="stylesheet" media="all">

The "?v=" is not useful.
This is already the case in 3.4
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix

Users browsing this thread: 1 Guest(s)