13 Ways to Speed Up your WordPress Site

One of the most frequently asked questions we receive from our customers using WordPress for their blogs or websites is how do I speed up my WordPress website?

Website speed has become an important factor for SEO purposes, don’t believe me, check what Google say. It makes sense, I mean who wants to browse through a slow loading website? Most people will leave the site and look else where for the information they need.

There are lots of different suggestions out there. Some of them will speed up your website considerably. Others may only make a fraction of seconds worth of difference to your page load times. If you’ve got a massive site with hundreds of pages and posts and it is taking a long time to get anywhere then you’ll want to squeeze every bit of optimisation out of it. For a much smaller site, just one or two of the ideas below will be enough to get your WordPress installation running much faster.

Recently I made some of the changes below to one of our clients websites it was taking over 12 seconds to load a page now this is no more than 4 seconds per page.

Visit  http://tools.pingdom.com and enter your site url and do  a speed test to see how long does it take for your website to load.

***Before starting with anything, be sure to make a complete back up of your WordPress theme  and your WordPress SQL database. ***

Install a Cache Plugin

A cache plugin is an absolute must have plugin that cache’s the mostly visited pages on your website and make them available to the next visitor immediately. The plugin generates html files which are served without ever invoking a single line of PHP.

Try using WP Super Cache or if you have experience with caching plugins try W3 Total Cache, I also like the easy to use Hyper Cache which is great for people on Shared Web Hosting. Hyper Cache is a very lightweight caching option for the average WordPress blog, offering speed without a lot of overhead. For more information on the plugin’s features, configuration, and support, please visit the Hyper Cache homepage.

Remove Inactive Plugins

Most of us love to try out a fresh new WordPress plugin. We are all guilty of installing ones we don’t really need, or of installing a plugin, trying it out, deciding we don’t really need it and deactivating it, leaving it sitting inactive in our installation (nb – an inactive plugin won’t slow your site down but it will take up space. This will only cause you problems if you have restricted space).  Its better to remove all those inactive plugins that you dont use.  So make sure that the plugin directory is cleaned up.

Tip:  Don’t use a plugin when you can use code

Keep Your WordPress Version Up To Date

With the release of new versions, WordPress keeps on improving, the developers put their effort in making WordPress faster and safer.  So be sure to grab the latest stable installation when you can.

Optimise the WordPress SQL Database

Just like your hard drive the WordPress database too can become fragmented.

To optimise the wordpress database of your site, visit your cPanel & use phpMyAdmin to Optimise and Repair the Tables.

If you are like me and like to be efficient, you could automate this process by either installing a plugin like WP-DB Manager or if you are a very confident and experienced web site designer you could setup a Cron Job, an automatic program that you can execute at specific times and at specific dates. You can set this up through your CPanel, but I would not recommend this if you are at all unsure of what you are doing.

Flush the Buffer

When a visitor to your site visits a page, it can takes around 200 – 500 milliseconds for the backend server to put together the HTML version of the page. During this time the browser remains idle. The flush() function in php will help by  loading the partially ready HTML page to the browser and it can start fetching the components, while the backend server is busy with the rest of the contents.

To insert the flush() function in your WordPress site, open up the header.php file and find the </head> tag and insert the <?php flush(); ?> function right after it.

</head>
<?php flush(); ?>
<body>

Add Expiration to Static Items

Adding an expiry time to your static images can reduce the number of HTTP requests when loading other pages in the site. Adding an expiry time to the images in the site help in loading the pages faster.

Simply copy and paste this code into your .htaccess file.

ExpiresActive On
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpg A604800
ExpiresByType image/jpeg A604800

Disable Hot Linking

Hotlinking is when another internet user uses an inline link to display an image that is hosted on your website. You know, those people who do a Google image search and not only think that it’s okay to use your image but also are fine about embedding the image using the link to the one you host, thereby leaching up your precious bandwidth.

You can ensure that this doesn’t happen by adding the following code to you htaccess file:

WARNING! Always backup your htaccess file before making any changes.

RewriteEngine on
 RewriteCond %{HTTP_REFERER} !^$
 RewriteCond %{HTTP_REFERER} !^http://(www.)?your-domain.com/.*$ [NC]
 RewriteRule .(gif|jpe?g|png)$ - [F]

 

Automatically Empty the Trash

You can set WordPress to automatically empty the trash. Simply add this line to your wp-config.php file. The number basically refers to how many days between WordPress trash dumps:

define('EMPTY_TRASH_DAYS', 10 );

Compress Your Images

The WP Smush.it plugin will automatically optimise your images for you. It removes extra bytes within them that are unnecessary, without compromising the images quality. Smaller images mean a faster loading site.

Host Video Externally

Unless you’ve got a super–fast server with loads of space, hosting your videos on services such as Vimeo or YouTube can help with your speed. If you have a site with loads of videos then no doubt you’ve already taken server speed into consideration but if you are just posting the occasional video you should definitely host elsewhere.

Compress the CSS Code

Compressing your CSS Code will make it’s size small and your browser can render it faster and that results in faster page load times. Compressing the CSS can be done in two ways. Either by doing it manually by using the service CSS Drive. But if you make changes to your CSS Code occassionally, then its better to use the WP CSS plugin. The WP CSS plugin will automatically remove the white space and compress your css files. Plus you will also have other options to set expiry time for the files.

Adjust Your WordPress Settings

There’s no reason to show 1000 posts on the home page of your blog, and you don’t even need to display the full post content on the front page. You can adjust this setting in the WordPress Dashboard under the Settings > Reading panel.

Turn off inter-blog communication

By default, WordPress interacts with other blogs that are equipped with pingbacks and trackbacks. Every time another blog mentions you, it notifies your site, which in turn updates data on the post. Turning this off will not destroy links to your site, just the setting that generates a lot of work for your site. For more detail, read this explanation of WordPress Pingbacks, Trackbacks and Linkbacks.

Look at your sidebar for any social widgets, plugins or javascript-based add-ons. Decide if  they are helping you bring in any traffic. Things like Google Friend Connect are almost never worth it and should be removed.

To conclude, what you want to do is look for scripts, add-ons, plugins,  javascripts, or social media tools with large load times or callbacks to external websites. Make sure you remove them whenever possible. Use basic file reduction techniques like using thumbnails instead of large images and use Caching plugins where possible.

Speed Testing Resources

What tricks do you use to speed up WordPress? Share it with us in the comments section & we will add it in to the post, so that everyone else can use it.

Related Posts:

Tagged , , , , , , . Bookmark the permalink.