How To Speed Up Your WordPress Site In Less Than 2 Minutes

Two quick WordPress performance fixes: optimizing CSS and JavaScript, and enabling browser caching.

Originally published on KeshKesh on November 5, 2013. View the archived original.

I’ve been playing around with the new Site Speed Suggestions Tool that was released today for Google Analytics, and noticed a couple of issues that popped up on my WordPress site.

One was that I needed to “eliminate render-blocking JavaScript and CSS in above-the-fold content” and the other was that I needed to “leverage browser caching”. Both sounded pretty intimidating, but with a little research I was able to fix both issues and improve my site’s speed score from 65 to 82 in just a few minutes.

Here are the fixes that I found:

Eliminate render-blocking JavaScript and CSS in above-the-fold content

This one is a common problem in most WordPress sites because many WordPress plugins come with their own Javascript and CSS files. What happens is that once you activate these plugins, all of the Javascript and CSS files are pushed into the header, and have to be loaded before the page can load.

The quick fix to this is to download the install the free Autoptimize Plugin. Once activated, just go into the settings and check the “Optimize Javascript code” and “Optimize CSS code” checkboxes, and it will automatically combine all CSS & Javascript files into a single file to reduce load time.

Total time taken: Less than 1 minute

Leverage browser caching

This one is another common issue, that can be fixed by setting an expiry date or maximum age for static resources (like images) in the HTTP headers to allow better browser caching. That sounds pretty complicated, but all you have to do is copy and past the following code into your .htaccess file, and you’d done (credit Thomas Griffin):

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##

If you need help updating the .htaccess file, I would visit the link above, but it’s really as simple as logging into your site via FTP, editing the file, and re-uploading it.

Total time taken: Less than 1 minute

So there you have it, 2 quick fixes that will get your site running a little faster in just a couple of minutes.