As many of you WordPress users already know, there is no shortage of plugins claiming to speed up your site. And for those of you who put them to the test against Pingdom Tools, GTMetrix, etc., you might agree most caching plugins don’t work as well as expected.

What if there was another way to substantially boost your WordPress site’s pagespeed score with as little effort as possible? Meaning zero time messing around with overly complex plugins, or gambling hard-earned cash on a premium plugin, or setting up a content delivery network (CDN)?

We spent some time on our site and came up with a few actionable tweaks to speed up your WordPress site, whether or not you’re a customer of Cyberia Technologies managed WordPress hosting. We avoided a CDN due to the upfront cost and mixed results, as well as combining/minifying/reordering of JavaScript & CSS assets due to the extensive testing required. Here are 3 easy ways to boost your WordPress page speed score:

  • Image optimization (trimming image file Sizes without impacting quality)
  • Setting up browser caching (you won’t need to download everything fresh each visit)
  • Removing query strings from static resources (otherwise browsers won’t cache files with a “?” in the URL)

Image Optimization

Going through and optimizing your site images is a good place to start, because even if you don’t see a score improvement, you’ll significantly reduce the file size of your website (read: faster loading times). EWWW Image Optimizer is a free WordPress plugin that works out of the box to remove metadata and other junk data from image files. By default, it won’t mess with image quality or compression, however, you can tweak those settings if you’re an advanced user. A word of caution though: compressing your images can have detrimental results. Take this example: Google’s page speed insights tool offers a download link of “optimized” images and assets, though surprisingly they are often ruined due to overly aggressive compression by Google’s servers.

Remember: use your best judgement with image optimization recommendations. Even Google’s page speed insights tool isn’t gospel and can offer bad/impractical advice (as with all page speed testers).

Configure Browser Caching

Next up, we have browser caching. Now this one can be a little trickier, especially if you’re already using a caching plugin. Before tweaking this, turn off browser caching in any caching plugin so you don’t create conflicts. If your host uses Apache, you may add this snippet to the .htaccess file or the apache2 .conf file:

<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType image/jpg "access 1 week"
 ExpiresByType image/jpeg "access 1 week"
 ExpiresByType image/gif "access 1 week"
 ExpiresByType image/png "access 1 week"
 ExpiresByType text/css "access 1 week"
 ExpiresByType application/pdf "access 1 week"
 ExpiresByType text/x-javascript "access 1 week"
 ExpiresByType application/x-shockwave-flash "access 1 week"
 ExpiresByType image/x-icon "access 1 week"
 ExpiresDefault "access 1 week"

If you know your host uses Nginx or a dual config, you shouldn’t use the code above. Instead, ask your host to add this snippet to your nginx .conf file (not .htaccess)

location ~* \.(js|css|png|jpg|jpeg|gif|ico|mp4|webm)$ {
 expires 7d;
 add_header Cache-Control "public, no-transform";
 gzip on;
 gzip_proxied any;
 gzip_min_length 1100;
 gzip_comp_level 1;
 gzip_types application/x-javascript application/javascript text/javascript text/css text/plain text/xml application/xml image/gif image/jpeg image/png image/x-icon image/bmp image/svg+xml application/x-httpd-php video/mp4 video/webm;
 gzip_vary on;

Notice how we’ve set everything to cache for 7 days/1 week. This is a good starting point in most cases, so your score doesn’t get marked down by the speed test tools. Once again, if any of this seems a little over the top or you’re not sure where to put the code, remember that your web host will know where to put it.

Remove Query Strings from Static Resources

Last, we need to remove query strings from static resources. This is so there’s nothing stopping our browsers from caching everything we need them to. Without this, the impact of the previous step will be significantly reduced. Though this last step can be solved through many means, we’ve found that the lightest, easiest method was to paste this PHP snippet into our Child Theme’s functions.php file. No plugin, no tweaking, no troubleshooting:

function _remove_query_string( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
add_filter( 'script_loader_src', '_remove_query_string', 15, 1 );
add_filter( 'style_loader_src', '_remove_query_string', 15, 1 );

Note: Pasting the snippet above in a Parent Theme is not recommended whatsoever. Not only do you risk accidentally splitting existing code, but you’ll lose all your hard work if you update your theme. If you don’t know what a Child Theme is, spend a few minutes researching it. We’ll cover this in a later post, but for now just take our word for it.

So there you have it. If you invest 15 minutes of time to implement one or more of these changes, you’ll likely be in much better shape than you were before. You are more than welcome to reach out with questions or if you’re curious about switching over to Cyberia Technologies hosting. We’ll do our best to help.