10 Steps to a Faster WordPress
by Keith Bryant
Traffic loss, reduced sales, and poor search engine performance – these are just some of the side-effects of a WordPress site that loads slowly. Previous research has proven that there is a direct correlation between page speed and visitor retention, bounce rate, and revenues. Further, even Google has publicly admitted to using page speed as a ranking factor in its algorithm – a part of its initiative to enhance user experience by propping up faster sites in the search engine rankings.
You can use free tools such as Google's own Page Speed tools family to gauge your site's load time. For most WordPress sites, a page load time under 2 seconds is excellent, up to 4 seconds is acceptable, and anything above 5 seconds will adversely affect search engine rankings and visitor experience.
WordPress offers significant flexibility in changing settings, adding/removing plugins and modifying theme options to enhance page speed (one of the many factors that have led to its immense success). Every WordPress user ought to take the following 10 steps to ensure faster site performance:
Step 1: Enable gzip Compression
Compressed code is faster code. Enabling gzip compression (a standard compression algorithm) in WordPress can reduce site load time by over 300%. While compatibility used to be an issue with earlier browsers, most modern browsers can handle gzip compression out of the box, with significant returns in site performance.
The idiot-proof way to enable gzip compression is to use a simple plugin such as Force gzip, which, as the name implies, forces gzip compression. Alternatively, you can use an advanced caching plugin such as W3 Total Cache (see step #5 below for more information about caching plugins).
Caveat:
Many shared hosting servers do not support gzip compression. To determine if your host supports gzip compression, create a file named test.php
that contains the following code and upload it to your server:
<?php phpinfo(); ?>
Load the test.php
page in your browser. If the mod_gzip or mod_deflate modules are listed and are enabled, gzip compression is available.
Step 2: Cut Down on Code Bloat
Many free as well as paid WordPress themes are guilty of using excessive HTML/CSS elements, which adds up to site bloat and reduced page speed. After installing any theme, ensure that you've removed all superfluous HTML and CSS elements, reduced unnecessary tags, and optimized and combined CSS rules for maximum efficiency.
Step 3: Compress Images
Loading large images places significant strain on the server, especially on high-traffic sites. Ensure that every image you use on your site is optimized and compressed to consume as little bandwidth as possible.
Run every image through a quick Photoshop optimization routine; this should include reducing the image size to exact dimensions, using an appropriate image format (.jpg
or .png
or .gif
depending on the image), and selecting low to moderate compression settings. As an alternative, you can use a plugin such as WP Smush.it to automate this process.
If you're using EasyRotator for WordPress, be sure to use the built-in Image Optimizer (accessible via the Tools menu) to optimize photos after adding them.
Step 4: Optimize Permalink Structure for Speed, Not SEO
Most WordPress sites set their permalink structure to /%category%/%postname%/
or /%postname%/
for its perceived SEO benefits. However, the WordPress codex categorically states that using such a structure forces WordPress to distinguish between post and page urls, which makes the server work harder and increases page load time.
Optimize permalink structure for speed by starting with a numerical field, followed by category
or postname
. Most major sites have adopted a year-month-postname
structure that looks like this and offers fastest possible site performance while still being SEO-friendly:
/%year%/%monthnum%/%postname%/
Step 5: Use a Caching Plugin
A caching plugin can enhance page speed by up to 300% by pre-loading common page elements and database queries, as well as compressing essential files. WP Super Cache has been the most popular WordPress caching plugin, but it lacks flexibility and several important features.
A better alternative is W3 Total Cache, which offers a plethora of powerful caching and optimization features that have been proven to enhance page speed significantly. While the learning curve for using this plugin effectively can be steep, the pay-off in performance is worth the efforts.
Step 6: Take Out the Trash
WordPress moves all deleted posts, comments, or media to the WordPress Trash directory, which works much like the Windows Recycle Bin. Over time, this 'trash' can accumulate and contribute to slowing your site. It is not a huge effect, but ever little delay adds up.
You can avoid this automatically by setting WordPress to automatically remove deleted files after a certain period of time. To enable this option, add the following line of code to your wp-config.php
file:
define ('EMPTY_TRASH_DAYS', 7);
The number 7
refers to the number of days after which the trash should be deleted automatically. You can set this to be as high or low as you want, but a week is a good value to start with.
Step 7: Use a Content Delivery Network
A Content Delivery Network (CDN) employs multiple servers spread across a wide geographic arc to serve pages to visitors more efficiently. Files are delivered to visitors from the server that is geographically closest to them, reducing latency and network congestion. On heavily trafficked sites, offloading static page elements (images, CSS, JavaScript, etc) to a CDN can reduce server strain significantly and improve page load speed by up to 350%. By reducing the load on your main server, CDNs also help to ensure that your site stays up in case of any sudden spikes in traffic.
While you might be tempted to use a free CDN plugin such as Free CDN, you often get what you pay for with such a service. It is recommended that you choose a professional CDN service such as Amazon's Cloudfront or Akamai (via Rackspace Cloud Files). You can use the W3 Total Cache plugin to integrate your site with the CDN.
Step 8: Minify and Combine CSS and Javascript
Minify is an add-on to PHP 5 that combines multiple CSS and Javascript files together into one of each type, then serves them with gzip compression. It is integrated into W3 Total Cache and other plugins. It reduces code bloat, removes excessive whitespace and avoids redundant server connections, resulting in faster page load times. Use this add-on to process all your stylesheets and JS files for a noticeable boost in site speed.
Step 9: Remove Unused and Unnecessary Plugins
Plugin bloat is one of the major causes of slow site performance. Most plugins create extra files to load and process, which, consequently, places strain on the server and increases loading time. Ideally, you shouldn't have to use more than 5 plugins in a WordPress install, and this figure should never exceed 10.
Update: Please understand that this figure is intended as a guidance point, not a hard limit. I promise – your installation won't implode if you use eleven plugins :-) Much depends on the nature of the plugins, how well they're written, and what other optimization methods you have implemented. It's just very easy to go overboard with tons of plugins. Always remember that there is a performance tradeoff with every plugin you add, so choose wisely.
- KB.
Step 10: Reduce Advertisements
Advertisements are usually the last elements to load up on a webpage as they rely on external servers to host their media. Flash and image-based ads are particularly guilty of bogging down performance; they can push an otherwise well-optimized site into the 'slow-loading' category. Reduce the number of ads on your WordPress site and you'll see a noticeable improvement in performance as well as visitor satisfaction.
Conclusion... Start Optimizing!
Optimizing your WordPress site is critical for keeping both your visitors and search engines happy. Use the ten steps I've shared in this article to make your site perform at its very best.
Have you had any experiences with great performance helping a site, or (hopefully not!) bad performance harming a site? Share in the comments below!