Easy IO (ExactDN) and Query Strings
If you've ever seen a recommendation like this: "Remove query strings from static resources"... don't. Just don't. If you want to know why, keep reading (or watch the video). But by all means, don't remove query strings!
So what's that all about, and how does it affect Easy IO?
The recommendation to remove query strings is a bit of a holdover from when there were many proxy (cache) servers that would not cache any resources with query strings. It wasn't just that resources would get mixed up from ignoring query strings, these (older) servers just wouldn't cache the files, ever.
First of all, Easy IO needs those query strings. It uses the query strings to enforce https on secure sites, to compress images, and to resize them. It's also what helps our cache systems know the difference between various sizes of an image, so they don't get mixed up.
Second, because Easy IO needs those query strings, our cache systems have been specifically configured to handle those files properly.
All of this means that you can safely ignore the recommendation to remove query strings. Especially when the files are going through Easy IO.
Will it Affect My Score?
Not that you should ever be chasing a particular score, since you should be focused on the actual speed of your site... but we have more good news:
Google and GTmetrix don't even recommend removing query strings any more, so violating the query strings guideline does NOT impact your overall score. So, rest easy, knowing Easy IO is making your site faster, and more user-friendly!
Hide My WP - Hide Version
The Hide My WP plugin has the option to Hide Version from Images, JS, and CSS. This seems great, as it prevents bots from knowing which version of WordPress, plugins, and themes you are using. Unfortunately, this removes the query strings that are needed to automatically refresh the cache when any of your JS/CSS files are updated.
As a workaround, you can enable the Random Static Number option in HMWP to work better with Easy IO. The Random Static Number option is under HMWP -> Tweaks -> Hide Options. However, HMWP regenerates the random static number every time a logged-in user visits your site (front-end AND back-end). This means JS/CSS assets will never be cached on the CDN for logged-in users, and guests will only benefit from CDN caching if you have a page cache.
Child Themes or Missing Query Strings
If you use a child theme, there is a good chance you followed the first example you found in the WordPress documentation. Which is sad, because it will use the current WP version, and any changes you make are stuck because of caching. But there's a better way, and it's on the same page. We'll include it here and explain a bit:
<?php add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); function my_theme_enqueue_styles() { $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme. wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ), wp_get_theme()->get('Version') ); }
Your existing code will probably be a little shorter, so let's break this down--and please make sure to use something unique for 'parent-style' and 'child-style'.
We are specifically interested in the wp_enqueue_style() function calls. Each bit between the parenthesis is a parameter. The first parameter is the "slug" for the style-sheet, and needs to be unique. Did I say that already? Good, make sure it's unique! The next line tells WordPress where to find your style.css file, and the one after that tells WordPress that there are dependencies, so that it will be sure to load the parent style first.
And finally, the most important part: the last parameter to wp_enqueue_style() is a function call itself, and gets the version from the active theme to use in the query string. That function looks in your style.css to find the version number, so that all you need to do is update the version number in style.css each time you make an update. If you're like me and test in really small steps, you might find yourself doing this a dozen times, but that's alright! Use really small increments, or even decimals, like 2.5.2.3 or 2.503, or even 2.5-test3. So long as you change the version each time, and make sure it's unique, your cache/CDN will see it as a new file and fetch the fresh copy that you just saved.
For custom plugins, or JavaScript, it's almost exactly the same, except you'll be calling wp_enqueue_script(), and you can just enter the version manually, like so:
wp_enqueue_script( 'my-js, plugins_url( '/style.css' ), array( 'dep1', 'dep2' ), '3.0.1' );
Have other questions about query strings? Let us know (below)!