If you own a WordPress website, you’ll have noticed by now there is an endless supply of plugins offering to speed up WordPress and boost your pagespeed. And for those of you who’ve tried putting them to the test against pagespeed analyzers like Pingdom Tools or GTMetrix, you might agree if we said most caching plugins are either too difficult to use or don’t deliver to the degree you’d have hoped.

What if there were a few effective ways to substantially speed up WordPress and boost your pagespeed score without much time or effort? Meaning no messing around with overly complex cache settings, gambling hard-earned money on premium plugins, or trying out a content delivery network (CDN)?

speed up WordPress and boost your pagespeed

In this article we share 3 quick ways to speed up WordPress and boost your pagespeed score (did we mention FREE?). We avoid a CDN due to upfront costs and mixed results, as well as methods that combine or reorder JavaScript due to the extensive debugging.

How to Speed up WordPress and Boost Your Pagespeed Score Quickly & Effectively

  • Optimize your images for the web (resize & compress images without adversely affecting quality)
  • Set up browser caching (visitors won’t download everything each visit unless the site changes)
  • Remove query strings from static resources (browsers can’t cache URLs with a ‘?’, so we safely remove it)

1. Optimize Your Images with WordPress

Going through and optimizing all of the images on your website is a great to start speeding up WordPress. Even if you don’t see an improvement in your numerical pagespeed score, you’ll dramatically reduce the overall file size of the site (read: faster loading times). EWWW Image Optimizer is a WordPress plugin that performs amazingly well without any setup. It works by removing metadata and junk data from your photos, icons, and other graphics. It won’t noticeably alter image quality, however you can tweak its compression settings if you’re an advanced user. A word of caution though: over-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 will sometimes offer impractical advice (as with all page speed testers).

Check out our in-depth image optimization guide If you want to learn more about different image file formats and the best practices for resizing images.

2. Configure Browser Caching on Your Web Host

Next, we recommend configuring browser caching. Now this step can become tricky if you’re already using a caching plugin. Before undertaking this step, you should turn off browser caching if you use a caching plugin to avoid conflicts. If your hosting provider uses cPanel or another panel powered by Apache, simply add this snippet to the .htaccess file in your site’s webroot,or in 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"
</IfModule>

Alternatively, if you know that your host uses NginX or a dual config (i.e. Plesk Panel), you should not use the code above. Instead, ask your host to add this next 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 the cache duration for 7 days or 1 week. This is a great default value and is also the minimum duration to boost your pagespeed score with most testing tools. If you’re not sure about this step or where to put the code, remember that your web host will know what to do. If in doubt, it’s best to reach out to them to configure this appropriately.

3. Remove Query Strings from Static Resources

To fully benefit from the gains in step #2, we now need to remove any query strings from static resources. This ensures that nothing will stop visitors’ browsers from caching what they’re supposed to. Without step #3, the pagespeed score bump from configuring browser caching will be somewhat limited. Though this last step can be solved through many ways, we’ve recommend that you paste this PHP snippet into your child theme’s functions.php file. This way there’s no plugin to maintain or tweaking after each update:

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: Though you can technically paste the above snippet into a parent theme functions.php file and be successful, it isn’t recommended. Not only do you risk splitting existing PHP code, but your theme will overwrite your changes with each update. If you don’t know what a child theme is or how to go about making one, here’s a great child theme generator plugin to get you squared away.

So there you have it. If you invest 15-20 minutes to implement one or more of these steps, you’ll be in way better shape on the web. You’re welcome to reach out with any questions or if you’re interested in switching over to Cyberia Technologies hosting. We’ll do our best to help.