Among all content management systems being used in the market, WordPress accounts for more than half of the market share. for years, webmasters around the world are trying out new tips and tricks to speed up their WordPress websites for the benefit of the users. In this post we shall discuss 20 best ways through which you can significantly reduce the page load time of your WordPress website.
1) Keep WordPress Updated
WordPress developers are constantly trying to improve the performance of the CMS and you must install the latest version WordPress 3.4.1 as it significantly faster compared to its previous versions. You should also try updating the version as and when major upgrades happen to keep the site in sync with the latest technology.
2) Take Note of PHP Queries
The major contributors to a slow WordPress website are the PHP and database queries as the browser has to execute a query each time the site is loaded. You can replace some of the PHP with HTML where your browser just reads the HTML and loads the webpages faster. Let us take a look at a complex PHP query.
<title><?php bloginfo(’name’); ?><?php bloginfo(‘description’); ?></title>
<meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />
<meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” />
<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” media=”screen” />
<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”<?php bloginfo(‘rss2_url’); ?>” />
<script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/mootools.js”></script>
An example of minimized query would be
<title>WPCandy – The Best of WordPress</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<meta name=”generator” content=”WordPress 3.1″ />
<link rel=”stylesheet” href=”http://yoursite.com/wp-content/themes/wpcandy/files/style.css” type=”text/css” media=”screen” />
<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”http://feeds.feedburner.com/yoursite” />
<script type=”text/javascript” src=”http://yoursite.com/wp-content/themes/yoursite/files/mootools.js”></script>
(Source: WP Candy)
3) Avoid External Scripts
There is a tendency to source all functionalities from third-party sources even the basic ones. Avoid sourcing scripts from external websites especially the unknown ones as they often result in slowing down the website. This can also happen when you are making use of multiple Widgets in your sidebar as you have little control over how they perform.
4) Use AJAX Libraries API
This helps in making web applications faster for developers in a simple way. It acts like a content distribution network and loading architecture for popular JavaScript libraries such as jQuery, prototype, script.aculo.us, MooTools and dojo. This can go a long way in helping your WordPress website render fast on the web browser
5) Cache The Database
MySQL is the default database for WordPress but runs multiple database queries when a page is being loaded. Plugins like the DB Cache help in caching the database queries which reduces the number of database queries to render a webpage and make the site load much faster.
6) Upgrade Plugins and Get Rid of Unnecessary Ones
Keep all the plugins updated in your website as this optimizes the page load time. Also get rid of unnecessary plugins which you don’t use anymore from the server as the CMS checks for their activity status ones the site is being browsed and slows it down.
7) Repair Database with myPHP Admin
This open source tool is useful in repairing the WordPress site database. You need to locate the database tables, select them and run an ‘Optimize Now’ function which will initiate a repair of the database and can help free space in the database and add to the loading speed.
8 ) Choose A Good Web Host
This might not seem like an out of the box solution to be incorporated into your WordPress site but it does have a significant role to play. Many site owners compromise on the quality of hosting to save a few dollars and you must avoid doing so.
9) Compress The JavaScript
WordPress websites are packed with JavaScript files and this puts a lot of pressure on the resources every time the JavaScript file is being loaded resulting in slow page loads. You can overcome this by using a JavaScript compressor which improves the page load time substantially.
10) Split Content Into Different Pages
Optimizing a website doesn’t always involve technical solutions as you can speed up a site simply by optimizing the way you post it. For large content it is advisable that you split it up into multiple pages which not only reduces the page load time but also makes the website user-friendly.
11) Optimize Images
Images do make your WordPress blog or website lively and attractive but large sized images are often the culprit behind slow page loads. You need to optimize the size of the images in the site and can use resizing tool which allow you to resize images in bulk and also rename them according to your need.
12) WP-CSS
This is an amazing plugins and strips whitespace from your CSS files. With this you can use @import inside a CSS file without any issues cropping at the user’s end. WP-CSS scans through the style.css file and put any @import files into it. This also allows you to set an expiry date.
13) Use WP Super Cache Plugin
This plugin is a hot favorite with WordPress developers as it allows you to easily generate static html files from your dynamic WordPress pages. Users are catered with the static HTML files instead of time taking PHP scripts which have to be loaded from the database.
14) Optimize Excerpt and Number of Blog Posts
Use only a small excerpt of the blog in your home instead of the full post and hyperlink it to the main post. Also reduce the number of blog posts in the index page as this causes unnecessary delay in the time required to load the website.
15) Add Expire Header
This goes a long way in improving the browsing experience of your regular visitors. Here you specify a time in the future so that the user’s browser doesn’t have to re-fetch any static content (such as css file, javascript, images etc). This can simply be set by using the following code in your root .htaccess file where the number stands for number of seconds in a month.
ExpiresActive On2
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
16) Defragment Database
MySQL has a major drawback as it doesn’t clean itself. Optimize DB plugin can come to your rescue as this performs optimize table command on your WordPress tables which literally defragments it. If the tables in your WordPress site are being updated regularly this plugin is a must for you. It has a very simple interface and just one ‘Optimize Now’ button in it.
17) Content Delivery Network Is Useful.
Using a Content Delivery Network or a CDN can prove to be useful especially if your website attracts huge volumes of traffic. It is nothing but a network of servers which work together to serve content to your users who are sitting in different parts of the globe.
18) Make Use of eTags
These tags are also used for the caching purpose and work similar to the expire tags. If you are using the Expire Headers you don’t need to make use of these. eTags can easily be enabled or disable in the .htaccess file and helps your returning visitors.
19) Disable Hotlinking
Often termed as bandwidth theft this is where other sites direct link to the images on your site adding to your load time. Too many sites making use of this technique can make your site crawl and you need to disable hotliking. You can place the following code in the .htaaccess file for this.
#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yoursite.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/yoursite [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
( source: wp Beginner )
20) Know The Page Load Time
It is very important for you to know how far has the optimization worked and this can be easily done by inserting the following code in your template. It allows you to know the exact page load time, the number of SQL queries that are being executed.
<?php echo get_num_queries(); ?> queries in <?php
timer_stop(1); ?> seconds.
These were some of the most popular ways of speeding up your WordPress website. Hiring the services of a professional developer is advisable as they manually code the website which can go a long way in improving the performance of the website.
I’m using wp-optimize to wipe out autodraft post, revisions post