Easy IO (ExactDN) and Query Strings

Once you activate Easy IO on your site, things will start to be faster, the clouds will disappear, and birds will start singing... Okay, maybe you don't get singing birds, but your site will be faster.

And you'll probably want to test just how fast your site is now, right? At some point, you might see a recommendation like this: "Remove query strings from static resources".

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!

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)!

Still need help? Contact Us Contact Us