How To Speed Up Your WordPress Website’s Load Time

  • 1
  • May 8, 2013
This website loads faster than 97% of all websites tested by Pingdom

This blog loads faster than 97% of all websites tested by Pingdom’s Website Speed Test as you can see in the report above. It wasn’t just naturally this fast, it took some effort. To save you time and help you speed up your WordPress site, I’ve outlined 18 specific ways you can do this on any WordPress driven web site. Some of these items will not be options if your web host doesn’t accommodate them, but most of them will be relevant regardless of your web host.

    Best Practices for Load Time Optimization

  1. Remove Unused Stylesheets & Scripts

    If you’re not using it, remove it.

  2. Remove Unused Images Referenced via Stylesheets

    Don’t reference what you don’t use.

  3. Disable Unused Plugins

    Make sure you’re only running plugins you actually use or they’ll clog up your site for no good reason.

  4. Ensure Elements Load Only When In Use

    For example, don’t load a script in your header file throughout your site if it only needs to be called on one page.

  5. Use JPG’s Instead of PNG’s when Appropriate

    JPG’s have smaller file sizes, if you don’t need the image to be transparent, then you don’t need it to be a PNG.

  6. Don’t Rely on Slow Third Parties

    Twitter is notorious for downtime and slow connections, cache their data, don’t depend on it being available all the time or it will destroy your site’s load time.

  7. Localize External Files Whenever Possible

    Don’t make external requests when you don’t have to; the more you make, the more servers you have to trust to not slow your web site down.

  8. Load All Stylesheets in the Head Before scripts where possible

    JavaScript generally takes longer to load than stylesheets, you don’t want your JavaScript to delay the loading of your styles.

  9. WordPress Plugins for Load Time Optimization

  10. Use WP Super Cache

    While this may be less popular than W3 Total Cache, I have found it to reduce load time more effectively. You’ll just have to deal with a less user-friendly interface to take advantage of it.

  11. Use Better WP Minify

    Sometimes it’s better not to minify your files, so test the load time with Pingdom’s Website speed test before and after enabling it, to determine whether or not it makes sense for your site. This is particularly true if you have a lot of CSS files being loaded, as one big group they can take a lot longer to load than they would separately.

  12. Use WP Smush.it

    Ideally you’ll be able to just bulk “smush” all your images. Yahoo’s Smush.it service tends to be a bit unreliable however. If it’s not working at the time, you can always run a GTmetrix report on your site and manually download the compressed version of the images it reports as not being optimized.

  13. Third-Party Services for Load Time Optimization

  14. Use a Content Delivery Network

    I recommend either CloudFlare – Click here for my setup guide or MaxCDN – Click here for my setup guide

    Why use a CDN on your Blog?
    A CDN (content distribution network) is useful for speeding up your website’s load time for your visitors, particularly users located far from your website’s server’s physical site. What it does is store your images, JavaScript & CSS files on locations throughout the world so they load faster via the closest POP (point of presence) site. This also helps reduce the amount of bandwidth your server uses. CDN service is relatively inexpensive with MaxCDN and free with CloudFlare and adds a lot of value, plus it’s easy to do, so why not do it? Anyone that takes their website seriously should use a CDN.

  15. Use CSS Sprites (create them with SpriteMe)

    This gem makes it super easy to create & implement CSS sprites for your site.

  16. .htaccess Tweaks for Load Time Optimization

  17. Enable mod_deflate

    After enabling mod_deflate on your server, add the following directives to your .htaccess file:

  18. Enable mod_headers

    After enabling mod_headers on your server, specify a vary: accept-encoding header by adding the following directives to your .htaccess file:

  19. Set Cache Expiration

    Add the following directives to your .htaccess file (with whatever expiration you feel is most appropriate for your site of course):

  20. WordPress Functions for Load Time Optimization

  21. Load JavaScript from Your Template’s Footer

    You can install the JavaScript to Footer WordPress Plugin…or just add it’s PHP code to your functions.php file:

  22. The problem is, some of your JavaScript files may not work properly if they’re moved to the footer. In this case you’ll have to move the JavaScript files to the footer on a case-by-case basis. You can do this utilizing the wp_register_script() & wp_enqueue_script() functions. These are normally found in the functions.php file of your WordPress theme. The fifth parameter in each function is $in_footer. As long as you set this parameter to true for both functions for a given script, the given script will then be loaded in the footer where the wp_footer() function is called in your theme’s template.

    For example if you had the script prettyphoto being included as follows:

    You would adjust it as follows to get it to load in the footer:

  23. Remove Query Strings from Static Stylesheets & Scripts

    Add the following to your functions.php file to remove them from all your scripts & styles:

  24. Use the following instead if you need to keep the version query string on a style or script for some reason (i.e. the Google Maps API reference breaks if it’s removed):

Share Your Results

Test your load time before following this guide. Once you have fully implemented these techniques, please share your results in the comments! Also, if you have any further recommendations I’d love to hear those too!

About Andy Forsberg

Andy Forsberg is Digital Marketing Director at the mobile & web app development company MentorMate in Minneapolis, MN and has been developing profitable websites for over 16 years. He started his professional career as founder of a major online music network of web properties. Andy is an expert at digital marketing and front-end web development. He is known for his Google Analytics, Salesforce, SEO & WordPress expertise. Connect with Andy on Google+, Twitter and LinkedIn.

15 Comments

Leave a Reply

Your email address will not be published.

Get a better WordPress Host The Best WordPress Hosts