How To Speed Up Your WordPress Website’s Load Time

22 Comments

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 19 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. Use the fastest WordPress hosting

    Everything on this list is essentially pointless if you’re on a bad WordPress web host, so make damn sure you’re not!

  2. Remove Unused Stylesheets & Scripts

    If you’re not using it, remove it.

  3. Remove Unused Images Referenced via Stylesheets

    Don’t reference what you don’t use.

  4. Disable Unused Plugins

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

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. WordPress Plugins for Load Time Optimization

  11. 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.

  12. 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.

  13. 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.

  14. Third-Party Services for Load Time Optimization

  15. 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.

  16. Use CSS Sprites (create them with SpriteMe)

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

  17. .htaccess Tweaks for Load Time Optimization

  18. Enable mod_deflate

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

  19. 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:

  20. Set Cache Expiration

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

  21. WordPress Functions for Load Time Optimization

  22. Load JavaScript from Your Template’s Footer

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

  23. 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:

  24. Remove Query Strings from Static Stylesheets & Scripts

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

  25. 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!

Want More Results?

Then sign up to the free Penguin Initiatives newsletter and get exclusive strategies that I ONLY share with my private newsletter subscribers.

You have Successfully Subscribed!

Andy Forsberg on twitterAndy Forsberg on linkedinAndy Forsberg on google
Andy Forsberg
Marketer, Entrepreneur and Blogger at Penguin Initiatives
Andy Forsberg is a digital marketer in Minneapolis, MN and has been developing profitable websites for over 17 years. Andy is an expert at digital marketing and front-end web development. He is known for his Google Analytics, Salesforce, SEO & WordPress expertise. Andy is also the creator of the open source Sexy Author Bio WordPress Plugin (the plugin being used to present Andy's bio to you right now) and the Chrome extension that detects WordPress Themes and Hosts known as WPSNIFFER.

Andy Forsberg is a digital marketer in Minneapolis, MN and has been developing profitable websites for over 17 years. Andy is an expert at digital marketing and front-end web development. He is known for his Google Analytics, Salesforce, SEO & WordPress expertise. Andy is also the creator of the open source Sexy Author Bio WordPress Plugin (the plugin being used to present Andy's bio to you right now) and the Chrome extension that detects WordPress Themes and Hosts known as WPSNIFFER.

Our Sponsors

Want More Results?

Then sign up to the free Penguin Initiatives newsletter and get exclusive strategies that I ONLY share with my private newsletter subscribers.

You have Successfully Subscribed!

More from our blog

See all posts
22 Comments
    • Andy Forsberg
    • April 24, 2015
    Reply

    Hey Magnus,

    You’re very welcome =)

    Other than the ones already mentioned, the official PageSpeed Insights tool from Google is pretty solid: https://developers.google.com/speed/pagespeed/insights/

    Also, when it comes to testing how your website handles many simultaneous users Load Impact is the best option I’ve found: https://loadimpact.com/

    Those are all the ones I use.

    • Magnus Kroll
    • April 22, 2015
    Reply

    Hi Andy,

    Thanks for this detailed article, very helpful for people speeding up their website (me). I was wondering if, besides pingdom.com and gtmetrix.com if you know of any other good other speed testers. So far I’ve come across http://www.webpagetest.org and http://www.giftofspeed.com but there don’t seem to be many other alternatives available? You know of some good ones? Thanks! Magnus

  1. Reply

    Hey Andi,

    If I were you I would try CloudFlare’s RocketLoader service (https://support.cloudflare.com/hc/en-us/articles/200168056-What-does-Rocket-Loader-do-). If you’re not doing anything too crazy with JavaScript it usually won’t break anything and the improvement in performance is completely insane, plus it’s a free service.

      • Andi
      • November 29, 2014
      Reply

      Thanks so much, Andy. I’ll give it a try!

    • Andi
    • November 26, 2014
    Reply

    Thanks for this helpful post. I have spent a good bit of time on trying to speed up my page load, although with a photo-intensive food blog, it will never be perfect. Here’s my problem: Ads. I can’t move that javascript to the footer because I just stick the tags in wherever they need to appear. They are all asynchronous, so in a tool like gtmetrix, my page load looks somewhat decent, but pagespeed insights seems to look at the total load time including ads. Is there any way to set some sort of delay for all js to load, even ads? Thank you!

    • Jeff
    • April 22, 2014
    Reply

    Hey there. Great post, thanks for sharing the tips. I’ve used the pingdom tool and I can already see that I have a lot of room for improvement with my site speed. My window tinting company website is here: http://www.alphatinting.com. I’m not exceptional with the technical side of speeding up my site. I’ve used caching plugins and minifying plugins before, but sometimes I notice it breaks certain parts of my site. Is this something that you offer as a service? If not, is there a place where I can hire someone for a one-time optimization for site speed?

    Thanks in advance!

    – Jeff

    • hangup
    • March 22, 2014
    Reply

    Now After trying this trick my site really got faster.

    • almo
    • February 18, 2014
    Reply

    hi. Thanks for the speeding tips.

    i get tht following error, if i insert the “Remove Query Strings from Static” Code:

    The Google Maps API Server rejected your request. The ‘sensor’ Parameter specified in the request must be set either ‘true’ or ‘false’.

    How can i resolve it?

    thx

  2. Reply

    Validation errors are not important at all in the whole scheme of things. So long as your site renders properly on the important browsers and for the various mobile resolutions they’re essentially irrelevant and fruitless to bother fixing. If I spent my time worrying about them above more important things (i.e. content, seo, load time, mobile rendering, etc.) then my site probably wouldn’t be one of the top 45,000 most visited websites in the world.

      • Nick
      • October 28, 2013
      Reply

      This is the second post I have seen where you brag about being a top 50,000 website. Full of yourself much?

    • Tony Franco
    • September 11, 2013
    Reply

    Hello Andy, Thanks by this worderful tips!

    I´m newbie.. I want to ask you: how i could put the css to run before java, to speed up the site? for java load i´m using php speedy.

    site: http://www.obrasdarte.com

    Thanks and Regards,

    Tony

    • johan
    • August 6, 2013
    Reply

    Exactly my thought! Those share buttons (L) (L) (L)

    • VirtualAlex
    • June 9, 2013
    Reply

    I have never seen sexier share buttons in my whole life.

    • Adam Lundquist
    • May 13, 2013
    Reply

    Nice article. yes on disabling unused plugins! I have so many!

    • Uber
    • May 12, 2013
    Reply

    There’s a very good compression tool for PNG images
    http://compresspng.com

  3. Reply

    wow, you are good coder
    This is my web http://www.simdepdenho.net

  4. Reply

    A note about jpg vs. png. Each type of image is different, so sometimes even gif is better if it is images like line drawings using only 256 colors. png is also sometimes better depending on the actual image. jpg filetypes are always best with photos. png is great for icons, and both png and gif support transparency but jpg images don’t.

    Andy, do you provide site and page load optimization as a service? If so, please contact me at http://www.21stsoft.com. Much appreciated.

    • Reply

      Thanks for the detailed explanation on the differences between jpg, png and gif, great info!

      My team and I at MentorMate provide these types of services once in a while, I’ll reach out to you.

  5. Reply

    Wow, awesome resource. Thanks for sharing!

    • Guest
    • May 9, 2013
    Reply

    Hey, I think you missed a closing tag on #15. I got a 500 internal server error until I added it.

    • Reply

      My bad, fixed! Thanks for pointing that out, my apologies!

 

Leave a Comment