Is your WordPress blog performing at it’s best? How quickly does the page load? Is it sluggish? Your website’s performance is one of the key factors in ensuring that the visitors are having a good experience with your site. So I personally think it is worthwhile to spend some time tuning/optimizing the site for performance. In this article I have listed various tips and tricks on how to speed up a WordPress Site.
Before diving into the optimization tips and tricks I recommend measuring the current performance of the site so you have some bench-marking figures to compare against after you make the changes and see how it has affected the performance.
How to Measure the Performance of a Site
You can use a combination of the following tools/options to measure the performance of your site.
1) PageSpeed Insights
I use the PageSpeed Insights tool from Google to measure performance and try to achieve a score of 80+ out of 100. PageSpeed Insights analyzes web pages and suggests ways to improve their performance based on a set of rules for high performance web pages.
You can also use YSlow addon for Chrome or Firefox to measure the page load time of a site. YSlow has an add-on integrated with the Firebug web development tool.
The site in question takes about 23 seconds to load which is not a very good page loading time. Some optimization could help!
3) Manual Observation
You can also use the stopwatch on your computer (or an online one) to test how long it takes to load a webpage.
4) Database Queries
The number of database queries a webpage makes to load the page have an effect on the page load time. You can use the following piece of code in the footer of your theme to find out how many database queries a page is making:
Make sure the webpage is not making any unnecessary database queries.
5) Speed Tester
You can use the website speed tester to find out how fast your site loads.
Basic WordPress Site Optimization Tips and Tricks
- Upgrade to the latest WordPress release (you should be doing this for security reasons anyway)
- Use W3 Total Cache WordPress plugin (forget WP Super Cache). W3 Total Cache is pretty good… even I use it ?
- Optimize your images so they load faster.
- Kill some plugins that are unnecessary or doesn’t add much value to your site (disable or delete these plugins).
- Optimize and Repair your Database from PHPMyAdmin. You can use the wp optimize plugin that does this for you.
- Check your theme Code (use good themes with valid HTML code).
- Get good web hosting.
Intermediate to Advanced Optimization Tips
- Use a good hosting provider (preferably not a shared hosting).
- Keep your page sizes less than 200kb. Do not use too many unnecessary images and videos on a page. Always compress the images appropriately.
- Combine CSS files into one big CSS file (one 50kb file loads a lot faster than five 10kb files).
- Reduce the number of dynamic PHP and HTTP calls (use sub-domains to share the load).
- Minimize simple unnecessary PHP queries. For example, instead of using <?php get_bloginfo(‘wpurl’); ?> just replace it with your WordPress installation URL so the browser can simply read it instead of making a query.
- Use external scripts. Instead of placing tons of code in your header.php file, put the code in external scripts. This allows the browser to cache the script so it won’t have to read it for every other page.
- Don’t use ETags unless you are taking advantage of it (how to configure ETags).