Optimize and Speed Up Your WordPress Blog

Guest Author

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.

Start Your Free Trial Today!

Browse all articles on the WordPress category or check the recommended articles for you below:

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

  • Swamykant

    Wow … this is an excellent. I have to try it soon 🙂

  • Lisa T.

    @Andrew North : I think you still do. I’m having problem in speeding up the blog till I use wp super cache. However, sometimes, my web still down for reasons that I still don’t have a clue. I can’t reduce my plugins, all of them are important to me and the site.

  • Andrew North


    This is a really insightful article and some of the tip are great such as using the WP-Supercache plug-in this is really useful.

    I was just wondering with the release of WordPress 3.0 will all this still be as necessary?

  • Megri

    My blog has lot of post and we face the same problems. Now used your advice has found the speed has gone up. Great advice Keep posting such kind of advices for WP owners

  • jack

    is it recommended to store repeating functions results in variables?

    For example, if I have the_title() or the_permalink() functions appearing more than once in my index.php.
    Will it be faster if I type and then echo $title1?

  • Vlatko

    Daniel please delete my comments above since I can’t post the code that Tom requested.

  • Vlatko

    Ok that didn’t came out well. Try this one:

  • Vlatko

    Try this @Tony:

  • Tony

    How do you make the pingback url static? Probably a dumb question…but I’ve googled it every which way and can’t figure this one out. They probably expect people to know this already…but at any rate, please help. Thanks

  • Kent @ Leawo

    Thanks for the inspirations! I have referred to some online tutorials and done some experiments. The optimization of php code really works and I have uninstalled some unnecessary plugins, too. I used to find my blog heavy to load and now everything is clear. More plugins mean lower efficiency. This is true with WordPress. I will continue to learn more and experiment and I would like to share some ideas with you guys later. 😉

  • Julius Kuhn-Regnier

    Is removing the widgets from the sidebar really going to speed up WordPress that much more? I am just not sure whether it does change that much?!
    Anyway good post 😉

  • icantinternet

    Thanks for these great tips! I will start implementing them one by one.

  • Blog Tips


    please update us on how it helped your blog, so everyone would know how effective and helpful it is

Comments are closed.