20 Tips and Tricks to Speed-Up Your WordPress Blog

The WordPress content management system (CMS) is by default a pretty fast and optimized software. However by using lots of plugins and “design heavy” themes can really slow it down. This affects directly your visitors because nobody likes a slow loading website.

There are a number of things you can do to speed up your WordPress blog, and quite a lot of methods will be discussed in this article.

Lets assume that you have created a killer article and you know that it will bring tons of traffic once you digg or stumble it. Now tons of users are on your blog and your blog serving them content using the dynamic PHP scripts files, this will put tremendous load on your sever and even you can face CPU outage. This is more likely to happen when you have a self-hosted blog.

If you can make static mirror pages of your blog posts, it will save you and your server. WP-Super-Cache plugin does exactly that and we will discuss in great deal in this tutorial. You should also consider following steps to reduce page load time

  1. Use fewer images.
  2. Optimize images before uploading. You can either use Photoshop to optimize JPEG files or use a JPEG compression utility like Advanced JPEG Compressor 2008. Create an action in Photoshop so that you don’t have to do repetitive tasks.
  3. Use minimum third party java script code; they really slow down the page load.
  4. Stay up to date with the latest WP releases. Every new wordpress release comes with lots of performance enhancements. Also don’t forget to update the maintenance release that follows every main release.
  5. Disable or preferably delete unused plugins. Every plugin executes quite a few scripts and SQL queries that might slow down your blog. Deleting unused plugins will save you some space.
  6. Stay up to date with Plugins, whenever a new WP version is released, plugin authors enhance plugins for performance and other enhancements. If you publish your posts from desktop visit your dashboard often to check weather a new version of plugins is available. WP 2.6 now gives you a visual indication about the plugins that need your attention. It shows a red blurb with a number inside it, that number defines how many plugins need your attention.
  7. If you have added a new feature to your WP blog by writing some PHP code that executes SQL queries; make sure that you minimize the load on the server.
  8. Place javascript code in an external .js file instead of dumping all the code in head section. Compress javscript code. A good resource for that is :
  9. Put external javascript files below the head tag.
  10. Remove duplicate scripts.
  11. Compress all CSS files.
  12. Do not put CSS documents outside HEAD tag.
  13. Check Firefox Error Console and eliminate errors from your code, if any.
  14. Check website load time using a cool utility called Pingdom.20 Tips and Tricks to Speed-Up Your WordPress Blog 1

    20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 2

  15. Reduce whitespaces in your CSS files and use shorthand CSS. It will increase the speed time. Whitespaces are great and every coder uses them extensively for better reading. The solution to this problem is that you make a copy of code on you local machine, kill all the whitespaces and upload the optimized the file to server. That way you will have a mirror of the code that you can read and modify easily later. Use Pingdom to check wheather it makes any difference or not.
  16. Optimize database using phpMyAdmin.
  17. Use Firebug Firefox addon to quickly find errors on your page. Apart from this you can do tons of thing with firebug including monitoring network utility.20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 3

  18. Install YSlow Firefox addon. YSlow analyzes web pages and tells you why they’re slow based on Yahoo’s rules for high performance web sites.20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 4

  19. Reduce DNS lookup, try to reduce number of domains to 4.
  20. And now the most important step, enable cache option. Use a very nice plugin called WP Super Cache, it is an advanced version of WP-Cache however you can choose which mode to turn on when you activate the plugin i.e. WP-Cache or WP-Super-Cache.

WP-Super-Cache plugin is a very fast cashing engine for wordpress. It generates static HTML files from dynamic blog posts. Once this plugin generates a static html file, that file will be executed in your browser instead of the wordpress PHP scripts that are much heavier and take far more time to load.

Static files are only displayed to following set of visitors…

  1. Users who are not logged in.
  2. Users who have not left a comment on your blog.
  3. Or users who have not viewed a password protected post.

It is correct because when user’s details are displayed on the post after they leave comments. These visitors are served dynamically and they are very few in numbers so your server is safe from being overload. Now lets study the plugin.

  1. Enable mod mime, mod rewrite and fancy permalinks on.
  2. Disable PHP safe mode.
  3. If above two settings are missing, you can still cache files but caching will be slow.

Step – 1

Open your .htaccess file, it should be in your website root. Insert following code into it.

# BEGIN WordPress

RewriteEngine On
RewriteBase /iblog/
RewriteCond %{QUERY_STRING} !.*s=.*
RewriteCond %{QUERY_STRING} !.*p=.*
RewriteCond %{QUERY_STRING} !.*attachment_id=.*
RewriteCond %{QUERY_STRING} !.*wp-subscription-manager=.*
RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]
RewriteCond %{QUERY_STRING} !.*s=.*
RewriteCond %{QUERY_STRING} !.*p=.*
RewriteCond %{QUERY_STRING} !.*wp-subscription-manager=.*
RewriteCond %{QUERY_STRING} !.*attachment_id=.*
RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /iblog/index.php [L]

# END WordPress

Step – 2

Create a new .htaccess file inside wp-content/cache folder and insert following code in it.

	`AddEncoding x-gzip .gz`
	`AddType text/html .gz`

Step – 3

Copy wp-super-cache/wp-cache-config-sample.php to wp-content/wp-cache-config.php. You have to copy the file wp-super-cache/wp-cache-config-sample.php to wp-content and rename it as wp-cache-config.php. Make sure that WPCACHEHOME variable is pointing to correct direction.

define( 'WPCACHEHOME', WP_CONTENT_DIR . '/plugins/wp-super-cache/' );

Step – 4

Copy /plugins/wp-super-cache/wp-cache-phase1.php to wp-content folder and rename it as advanced-cache.php.

Step – 5

Open wordpress config file \wp-config.php and add following code just above

require_once(ABSPATH . 'wp-settings.php');

So entire code block will look like…

if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');
	define( 'WP_CACHE', true );
	require_once(ABSPATH . 'wp-settings.php');

Step – 5.1

Choose Settings > WP Super Cache. Now you should see options. You can turn on and off cache from there. You can even set legacy WP-Cache caching from there by clicking on the HALF ON radio button.

20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 5

Step – 6

Next you can enable or disable compression from there.

20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 6

If your browser keeps asking you to save the file disable the compression.

Step – 7

Next you can set the expiry time and garbage collection numbers. By default a very high frequency has been set because new WP-Super-Cache plugin works much better then legacy WP-Cache plugin. If your site starts to slow down, decrease the time and also the garbage collection. Garbage collection number defines, How often should expired files be deleted?

20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 7

How would you know about the appox number? Well read out few lines below Garbage Collection options.

Checking for and deleting expired files is expensive, but it’s expensive leaving them there too. On a very busy site you can leave this fairly high. Experiment with different values and visit this page to see how many expired files remain at different times during the day. Simple rule of thumb: divide your number of daily page views by 5 and pick the closest number above.

Step – 8

20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 8

Next you can set the rejected URIs.

Enter strings here that forces a page not to be cached. For example if you don’t want to cash last year entries enter /2007/ in the box. If any uri accessed that contains the substring /2007/, WP Super Cache will not cache that page.

Step – 9

Next you can set the filenames that can be cached, even if they match one of the rejected substring specified in step-8.

20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 9

Step – 10

Next set the options to prevent WP-Cache from caching bot, spiders, and crawlers’ requests.

20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 10

Step – 11

Next this plugin displays number of Cached and Expired pages for both WP-Cache and WP-Super Cache and you also have two buttons for deleting Expired and Cached pages.

20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 11

Step –12

If you are expecting huge digg traffic on a page, cache that page directly. Directly cached files are files created directly off where your blog lives. Lets assume that you have a uri and you are expecting huge traffic from digg. You can enter either or /game/ in the box. Click on update direct page. Next time when an anonymous visitor will visit your site, cached file will be generated.

20 Tips and Tricks to Speed-Up Your WordPress Blog | Image 12

As you can see this plugin is little complex to set but the results are wonderful. Install it and please share your experience with us.

About the author

Author : Pradeep Mamgain
Website :
Description : We help you in understanding and taking maximum advantage of the software tools and web technologies..

We are looking for contributors

We are looking for talented bloggers, that want to promote themselves and their websites by writing articles for our blog. The topics we are interested in are : Graphic Design, Web Design, Flash, Photoshop, Vectorial Graphics, Design Inspiration, Programming, Print Design, Design Resources, photography or just “top 10 articles”. If you like the idea and want to submit an article or just want to find out more, please visit our Contributors Page.

Written by CrazyLeaf Editorial

Follow us on Twitter @crazyleaf , Facebook , Pinterest


We are looking for contributors

Professional osCommerce Templates