Optimize and Speed Up Your WordPress Blog


background image

This is a guest post by Vlatko. If you want to guest post on this blog, check out the guidelines here.

If your blog is on shared host but starting to get some serious traffic, then you are probably having problems with slow database queries, and in the future you might even be suspended because of exceeded CPU quota. The outcome will be frustration on your side and annoyed visitors on the other side.

The first reaction will be to file dozens of support tickets with the hosting company. After that you might consider moving to VPS or Dedicated Server, but before doing that you should try some tricks to improve the loading speed of your blog and survive higher traffic on shared hosting.

Important: before attempting to do anything with your blog please make a fresh backup of your database and WordPress files.

1. Use just few necessary plug-ins.

The less plug-ins you have, greater loading speed you achieve. So deactivate and delete the plug-ins that are not really necessary for your blog.

2. Use pure code in your sidebar instead of widgets.

This one seems radical but it’s very easy to implement. Make a research and you’ll find code examples for showing recent posts, categories, tags, etc. on your sidebar without use of any widgets.

3. Disable post revisions.

Post revisions are only building up your Database with records. The only thing you have to do is to put the following line in your wp-config.php file:

define('WP_POST_REVISIONS', false);

4. Remove extra tables in WordPress Database.

Login to your host, go to your phpMyadmin, open your blog database and you’ll see the table structure of your wordpress database. The default DB tables for wordpress are these ones:

  • wp_comments
  • wp_links
  • wp_options
  • wp_postmeta
  • wp_posts
  • wp_terms
  • wp_term_relationships
  • wp_term_taxonomy
  • wp_usermeta
  • wp_users

If you have some extra tables (which are not used by your plugins at this moment) delete them. They are there just because you’ve installed and uninstalled plugins in the past. Some of the plugins create extra tables in the DB and when you decide to remove them some of the tables are staying there. You don’t need them, so drop them.

5. Clean up your WordPress Database.

For this step you’ll need one very useful plug-in. It’s called Clean Options.

Install it, activate it and use it to clean up your wordpress database. It will erase unnecessary, redounded, orphaned records. Then you are done with this plug-in, so deactivate it and delete it. After doing this, please test your blog and plug-ins for functionality. If some of your plug-ins stopped working, just reinstall them and you’ll be fine.

6. Repair and optimize your WordPress Database.

Go to phpMyadmin again, select your database check all the tables, and in the dropdown menu select repair. Select the database again, check all the tables, and in the dropdown menu select optimize.

7. Change php code with html where applicable.

This tip is probably the most powerful of all these tips. The point is that in the header (sometimes footer and sidebars) of your wordpress theme you have php strings that every time when your blog loads they call your blog name, location of favicon.ico, stylesheet, ping file, feeds, charset etc.

All these php requests are slowing down your blog so why not changing them to static html code.

For example the following code:

<link rel=”stylesheet” type=”text/css” media=”screen” href=”<?php bloginfo(’stylesheet_url’); ?>” />

Can be changed to:

<link rel=”stylesheet” type=”text/css” media=”screen” href=”http://your-domain-here.com/wp-content/themes/your-theme- folder-here/style.css” />

You can also:

  • make your pingback URL static,
  • make your feed URL’s static,
  • you can remove the blog’s WordPress version,
  • make your blog’s name and tagline/description static.

The easiest way to do this is to compare the actual header code of your blog with the outcome header code (right click, view source code in your browser). Look at the original php code and see what the results are in the outcome source code of your blog. By doing this you will realize which php lines you can change to static html lines. Don’t be afraid to experiment.

8. And finally use WP-Supercache plug-in.

Probably you’re already using this plug-in, but for the ones who don’t you should know that it will greatly speed up your blog since it saves and stores static html pages of your blog and serves them to the browser without any heavy impact on your host.

9. Bonus tip:

Optimize your files (CSS, Javascript, images, video) and don’t overdo it with external loads (CPM combo ads, scripts etc.)

The intention of covering these tips was not to give you thorough technical knowledge, but to inspire you to experiment and research. These tips will give remarkable results and you’ll be really stunned when you’ll see how fast your blog loads even on a shared host. I personally tried all of them and I can guarantee that they have truly amazing effect.

Vlatko is the owner of TopDocumentaryFilms.

Browse all articles on the WordPress category

44 Responses to “Optimize and Speed Up Your WordPress Blog”

  • George Serradinho

    I had a look and then made some simple changes and I can see the difference now. At one stage I had over 16 widgets, now I’m down to only 6 and the rest I have coded.

    I will be checking out the other hints and see what else I can change.

  • crazy blogger

    my blog is loading very slowly

    this tips may help me in optimizing it to load faster

  • V.C

    In my opinion, Wp Super Cache is really useless. It may also slow down your website for some reasons. So I don’t think using Wp Super Cache is a good idea.
    I suggest you guys using WP-Optimize plugin which can help you do the step 3 and 6.

  • Melvin

    Not going to say I agree with most but some of the tips you listed are helpful (especially no.7)..

    I don’t see though the essence of using codes instead of widgets. I mean widgets are built for convenience and not preferring to use them is inconvenience. Also I don’t think it takes that much toll on a blog’s speed

  • Robomaster

    Good job with the post Vlakto! I’m just starting up my blog so I’m finding it very helpful to optimize it before doing anything else.

  • Blog Tips

    Nice set of tips there, as we all know with new google updates blogs that has more speed will now be ahead in Search Engine compared to those who has slower sites

  • Hesham @ FamousBloggers

    Great post, I have been working on this recently.. mmm I think since I got my Thesis theme which helped me to create a very fast loading blog than ever!

  • Digigirl

    This is a great to-do list. I went through the entire list and lo and behold! It really did speed up my blog considerably. I’ll be sure to do this periodically. Thanks for the how-to!

  • DK

    This post couldnt have come at a better time. The timing is impeccable. I had my first support ticket from my host since my site seemingly consumed a lot more CPU and memory just yesterday and I was looking out for tips and tricks to improve my site!

    Thanks a bunch for these tips.

  • Keith Davis

    I’ve been wondering about the excessive use of plugins.
    Trouble is, there is a plugin to do everything. Well almost everything.

    Think I’ll try the “WP-Supercache plug-in” that you recommend.

  • Justin L

    Another good way to speed up your blog is to use CSS sprites for your images, that way you only load one image for several different “sprites”.

  • Vlatko

    Thanks folks!

    @carl I don’t think that If you turn on wp-supercache, tips 1 through 7 are redundant.

    wp-supercache caches pages which are visited once, stores them as html and serves them to the followup visitors until expiration. You don’t have cached version of all your pages all the time in every moment unless you set the expiration time very high which is not smart thing to do.

    So those tips will have a huge impact on the blog speed and the visitors’ browsing experience when they land on a page that is not cached, and relative number of visitors will land on a page that is not cached.

    Keep in mind that here we are talking about shared hosting environment. We all know what is best – Dedicated powerful server tied with content delivery network.

  • Satish Gandham

    You forgot a point, Use a light weight theme.

    Like SWIFT

  • Oliver

    Some great tips here. Will have to bookmark this post and try out the tips on my blog and see what results I get. Thanks for sharing these tips with us.

  • harrison

    Thanks excellent post

  • BloggerDaily

    wo. quite complicated for me as i’m still novice with PHP. btw, nice tips and i’m looking forward to practice them! =)

  • Hal Brown

    In response to Chande – WP Super cache plugin – I had almost the same experience. My primary blog is hosted with Doreo. After installing WP Super cache plugin the site went completely down. This is scary.

    After some research on the net, I discovered that WP Super cache causes a lot of problems for a lot of people. Note that with Host Gator I never had this problem.

    I suggest that anyone be very cautious installing this plugin. It is not all that easy to uninstall – it writes a lot of code to several different files including wp-config and htaccess. You can easily find the uninstall sequence online.

    I did install W3 Total Cache and it does speed up page loads. And most of all, it didn’t take down the site.

    I believe the bottom line is, if you are getting a lot of traffic, don’t use shared hosting. Pay the extra bucks for a dedicated server and IP. And if seems scary to do the maintenance, hire someone to do it.

  • Offerte ADSL

    Nice tips, thank you 🙂

  • Gabe | freebloghelp.com

    Thanks for the tips for speeding up WP. I mean, who couldn’t use a little speed burst?

  • Chanda | BizDharma.com

    Hey one imp point

    After reading about the WP Super cache plugin couple of months ago, I did give a try but my website started displaying junk characters (My site too hosted with Doreo) later they informed me that they are doing sufficient caching at their end and anything further will geerate such crap output frequently. After disabling the plugin I dont have any issues. So do ask your host before going ahead with the plugins. They might seem to work well on your comp but shows crap on other

    Hope this helped


  • Andrew @ webuildyourblog.com

    One thing that speeds up load time is ‘optimizing’ your images. I use the free tool IrFanView. It helps reduce the size of images by 30%.


    • Michele

      I agree! I’ve used Irfanview for some time and it’s great…It’s especially useful if you are selling products and having to include LOTS of images on your site.

  • Cathy

    Sorry about last post…it only applies to people who have wordpress.org.

  • Cathy

    Not to smart when it comes to optimizing, however I liked your post.
    could you maybe explain the how to’s on this:

    6. Repair and optimize your WordPress Database.

    Go to phpMyadmin again, select your database check all the tables, and in the dropdown menu select repair. Select the database again, check all the tables, and in the dropdown menu select optimize.

    keep me posted.

  • carl

    If you turn on wp-supercache, tips 1 through 7 are completely redundant, except for the relatively rare cases where a cache miss occurs, or a cached page is regenerated.

    Some further tips for speeding up your site:
    – combine most javascript and css into single files, and minimize and compress these.
    – combine theme element images into a single file as css sprites
    – consider moving images and other static resources to a content delivery network

    Also, sometimes it’s more cost-effective to just invest in better hardware to host your site. If you compare the cost of many man-hours of work for a small speed improvement with the cost to just jump up to a beefier server, a faster box will often give you much more bang for your buck.

  • Antti Kokkonen

    Great tips Vlatko! Blog optimization is one of my favorite topics, because slow or unavailable blog is a guaranteed way to turn new visitors away, no matter how good your content is! And getting rid of “plugin fever” is a great place to start…

    People make their blogs plugin heavy quite fast with all the “top 30 wp plugins you MUST have” posts around, so always think hard if you really need that plugin you’re about to install, and do go through your plugin list and start deleting them unless you really need them..

    Apart from decreasing the number of plugins, I think the most essential optimizations tips for a WordPress blogger are optimizing the theme, css and javascript — Minify and compress everything you can, combine all js/css-files into one, avoid loading unnecessary scripts and when applicable, load the javascripts at the end of the page. While optimizing the theme, I would minimize the use of images, in addition to using html instead of php like Vlatko suggested as the tip#7 — For the images that you need to use in the theme, use CSS Sprites technique to put all the images into one file (reducing the number of http requests).

    Also, if all this optimization sounds scary, remember that it all adds up, so don’t feel that you should do everything if your not exactly tech-guru. Ask/hire for technical help to do the optimization — or just do what you feel confortable doing yourself and start with a cache plugin like WP Super Cache (make sure you configure it the right way) and turn on compression and caching with simple .htaccess rules. I have an article on my blog about those, so take a look if you like:

  • GoBusiness101

    Very well said! I’m in a shared hosting, so far no problem.

  • Mirko

    If you are using a javascript framwork, another great way to optimize your website is to let Google host it for you: http://code.google.com/intl/fr/apis/ajaxlibs/

    Not only you are using Google servers power and unloading yours, but since many websites are using the same file it’ll probably be in your visitors browser cache.

  • Phaoloo

    Some of these tricks may be applied for blogger.com too.

  • Chad

    I’ve been looking for something like this. Thank you.

  • Dana @ Online Knowledge

    Thanks for this great tips. I had been in long time want to optimize my blog speed but do not know where to start. And i already knew. 😀

Comments are closed.