Site speed has been used as a signal for rankings since 2010, your website’s performance is one of the key factors in ensuring that your visitors are having a good experience reading your site. Personally I therefore think it’s worthwhile to spend some time tuning/optimizing your site for performance. There are lots of benefits of having a superduper fast site!
When you are building a website, it is essential to consider its loading speed. Experts believe that slower sites get fewer visitors as compared to faster websites. Optimizing your WordPress theme for speed and maximum performance will lead to a positive change.
Before diving into the optimization tips and tricks, I recommend measuring the current performance of the site so you have some benchmarking figures to compare against after you make the changes and see how it has affected the performance. You can use tools like Page Speed tool to check how your site scores.
In this article I want to give you some solid and basic tips and tricks to optimize your WordPress site. I know there are a lot of plugins out there to help you optimize your blog but I will not go in full detail on those in this article.
Always keep up with the latest WordPress version. This will ensure that your site will run at its optimal performance and remain secure.
Use a good, well-coded Theme
Check your theme code (valid HTML code). Valid markup language is absolutely vital for page speed and SEO rankings so make sure your theme looks good. Remove unused code, this saves bytes and minimizes bandwidth use.
By combining your CSS files into one and JS files into one you will significantly save HTTP requests. If you don’t know how to combine, minify and compress the JS/CSS resources loaded, here’s a plugin that can do this for you: JS & CSS Script Optimizer or Better WordPress Minify.
header.php file, use external scripts. This allows the browser to cache the script so it won’t have to read it for every other page.
First of all, clean up WordPress from unused plugins and themes, make sure any plugins that you are not using is deactivated or deleted, this will prevent them from loading when your site loads. Be selective in your selection of plugins. Some will have a major load on your database, ask yourself if you really need it in your website.
Bad plugins can slow down your site. If you think this is the issue try disabling all plugins and see if that helps. You can also use a Plugin Performance Profiler like P3. Second, make sure the remaining plugins and themes are updated to the most recent version. This will keep your site fast and secure.
Note: you should only download plugins from WordPress’ repository and not from third-party sites which may be phishing genuine ones or may include malware in the download.
Caching plug-ins speed up your site and lead to a number of wide-ranging benefits for users who visit and re-visit your site. The easiest way to speed up your website is to install a caching plugin: WP Super Cache and W3 Total Cache are the most popular.
I myself use WPSuperCache, which generates static html files from my dynamic WordPress blog. After an html file is generated the webserver will serve that file instead of processing the comparatively heavier and more extensive WordPress PHP scripts and will not actually load any content from the database at all, hence the post will load faster with less stress on your server.
Note: Make sure your Caching plugin is working properly and that the response is coming gzip-compressed! If this doesn’t work you can always use .htaccess Gzip compression for additional speed and compression.
Optimize and Repair your Database from myPhpAdmin
Every month or so you should login to your myPhpAdmin and optimize your database. Locate your WordPress Database Tables, check all the tables in the Check Boxes, select the Optimize Tables Option and repair. These will sequentially interrogate your database tables and auto-repair any hidden issues. This may well translate into faster database speeds for your WordPress Data.
Before doing anything with your database, make sure to backup your database before making major optimization efforts or attempting to repair tables.
Note: Keep your database optimized to reduce overhead. If you’re afraid of phpMyAdmin try the OptimizeDB plugin.
Minimize PHP and Database Queries
The number of database queries a webpage makes to load the page has 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. Some plugins can balloon your database queries through the roof as well as some WordPress menus can do.
<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.
Each time a page on your site loads, if your browser has to execute any PHP queries, it adds to the load time. If you replace the PHP queries with static HTML, every time a page loads, your browser just reads the HTML. 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.
Over the past year, web pages have on average become 25% bigger. Images have always been, and continue to be, the biggest single factor to page size. Their contribution to page size has also increased the most if you look at sheer file size. A great way to optimize images in several lossless ways, is to make use of Yahoo’s Smush.it
WP Smush.it offers an API that performs these optimizations (except for stripping JPEG meta data) automatically, and this plugin seamlessly integrates Yahoo’s Smush.it with WordPress.
Note: you can read more suggestions to optimize images and graphics in an earlier article here on the gonzoblog.nl
Analyze the Timeline (waterfall) Report
For this you can use Google Chrome’s Dev Tools or FireFox’s Firebug, but there are other programs that will do exactly the same, load the page in a browser and analyze its ‘timeline’ report, also referred to as ‘waterfall’. If you’re showed an extensive amount of external resources loaded, you know it’s time to clean up the sidebar from all additional widgets, or to delete some of your ‘social buttons’.
Note that report numbers don’t carry much meaning as they will most definitely vary wildly depending on client-server geographic locations and connection speeds. What matters more is the overall loading behavior and the way your changes impact it: how many resources are loaded, what resources are loaded from external (potentially slower) domains, are they compressed, combined together or minified, which resources load most sluggishly and so on.
Note: while this kinda reports are useful for spotting the most obvious bottlenecks, it provides a network-only view of the page loading process. If the ‘timeline’ report hasn’t provided you with enough data to work on, run PageSpeed or YSlow to get a detailed list of suggested optimizations.
Consider using a CDN
A CDN, otherwise known as a Content Delivery Network, allows you to store static images and large files on third-party clustered servers around the world. The user will get served the static files from the servers closest to the selected server, thus speeding up page download times and freeing up resources on your main server.
Using a jQuery CDN has many of the same benefits as mentioned above. If you use jQuery hosted on Google CDN there is a big chance most of your visitors already have the file cached in their browser so they don’t have to download it again for your site.
A good hosting provider is one of the most important elements of page speed optimization and WordPress performance. You don’t want to run your site on a shared hosting service. Select a hosting solution that is close to your target audience, proximity to the web server has a huge impact on load time.
Note: Nothing slows your site down like bad hosting.
I still have lots of room for improvement, but at some point you have to consider the cost / benefit factor too. For now the gonzoblog is fast enough, but I’m considering to move to another hosting party where I can make use of a CDN.
- § -
If you know any other great tips or tricks to increase performance of your WordPress site, I hope you could share this in the comments with us?