WordPress performance optimization

WordPress has become widely used blog and CMS platform in recent years. However, with it’s functionalities and new capabilities users need to cope with less performance, bigger server resources and increased page-load times. However, we can make something to make the situation better and I will introduce you to many WordPress optimization tricks and tips varying from using less plugins to database and server optimization.

SEO-friendly urls usage and structure

If you WordPress system uses lots of server resources including so important RAM, you should check if your seo-friendly urls are not made of /category/post-title/. This kind of configuration uses the most server resources because every time you load some page, the script has to go trough all the database table to find the right post title. The best solution for this is to make your urls more friendly for performance by including some date.

For example, you will have less problems if your urls had been with a year and a month: 2011/02/post-title. You can adapt everything for your needs, but the secret is that now script needs to look only at the fields near 2011 and 02 for the right page.

WordPress plugins number and usage

There’s no need to use so much plugins on every day basis. You should not use two same purpose plugins at once because each of them usually load additional information or styling, javascript files and so on. You should try to have as little requests to those files as you can. Many included files not only makes your page load time longer, but is not good for search engine robots too.

Furthermore, not only the quantity of used plugins is bad, but the plugins themselves. As WordPress became very popular lots of amateur programmers create plugins and those plugins usually are not created with performance in mind. In my practice I had some really bad experiences, for example, when simple plugin makes your website go down without explanation and so on.

However, you should consider using WP Super Cache plugin which might help you incredibly fasten your website load times. But I warn you in advance, that you need to be careful with its settings. For example, do not forget to clear the cache after changes to your theme or code otherwise you might think that something is not working.

For example, you do not need to install a WordPress plugin if you need to add some Twitter and Facebook buttons. All that you need is to add a simple function to your template’s functions.php file. Here’s a code for that:

function share_this($content){
    if(!is_feed() && !is_home()) {
        $content .= '<div class="share-this" >
                    <a  href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a>
                    <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
					<br /><br />
					<div class="facebook-share-button" >
<iframe src="http://www.facebook.com/plugins/like.php?href='.
scrolling="no" frameborder="0" style="border:none;
overflow:hidden; width:150px; height:21px;"
                </div><br />';
    return $content;
add_action('the_content', 'share_this', 10, 1);

Compressing images and files, using sprites and lazy load

I have already said that many requests to your server for files, images is bad and you should consider using one big CSS and JavaScript file for all your code. However, do not stop here and compress those files using great web applications and tools.

Yahoo Smush.it helps you compress images. You can even download a special plugin for WordPress that will help you do this automatically. This plugin can also smush hosted images if you want to take care of your previous posts.

There are lots of tools for compressing CSS too and couple of them has advanced settings too, for example, to compress color codes and other fancy stuff. Try MinifyCSS with many advanced setting or a much simpler CSS Compressor. Play with settings and choose the best that fits your needs.

And for the javascript part I would recommend YUI Compressor or JSMIN. Those two tools are safe and really good. However, if you do not like them you might check out JavaScript Compressor.

After you successfully optimized your images and files you should think of using CSS Sprites. If you are not familiar with this great technique visit SmashingMagazine article and you will know everything about creating and using CSS sprites.

Moreover, another great technique that improves page load time is called Lazy Load. You can read more about Lazy Load in WikiPedia, but the main principle here is that you do not load all the images at once and if user scrolls down, only then images or other information is loaded. You can find a WordPress plugin for that too if you do not have needed javascript knowledge. Try jQuery Image Lazy Load WP which is just remade from simple jQuery plugin.

Do not forget to include your javascript files and code for stats at the footer of your page if those animations or effects are not needed before the page load. This helps to load the page faster too.

Less advertisements

Flash advertisement is a great way to gather more clicks and visual experience, however this makes your website load time longer too. I suggest to review all the advertisement in your website and get rid of any advertisement that has bigger impact on your websites performance. I am not talking about Google AdSense or similar alternatives, they are usually optimized and the right option for you to make some money from your content. But do not overdo with flashy and fancy advertisement.

WordPress database optimization tips

WordPress uses MySQL database and as more advanced programmers know MySQL is not the fastest tool out there, however it’s good for daily websites needs and there are some simple tips to make them better.

For example, you can optimize your database tables without any additional plugins. You just need to login to your phpMyAdmin and check tables having overhead and optimize them. MySQL tables have overhead when you delete data and it holds the spaces of deleted data for future use, so when you insert something new it uses the overhead, but if you constantly and heavily delete information, for example spam comments, the overhead might be big enough. You will find ability to select overhead tables and optimize them below all the tables list, see a screenshot.

In addition, you can set your trash can to be erased more often. You need to one more line to your wp-config.php file:

define( ‘EMPTY_TRASH_DAYS’, 5); 

This means that your trash can will be deleted every 5 days.

You can also cache your database table by using DB Cache Reloaded plugin. It caches your database queries for specified lifetime. Another great alternative for caching your database is WPDBManager. Moreover, with this plugin wou will be able to create backup copies of your database.

Special WordPress hosting

You might also try and like special hosting providers who configures their servers for best WordPress experience and load times. Moreover, prices are quite normal and does not differ much from casual hosting provider. But keep in mind that your hosting provider makes a big impact to your whole system performance too and you should not believe that a cheap hosting provider is your best choice.

To sum up

WordPress is a great system for your blog or CMS, but you need to take care of it after some time because users and yourself sometimes make bad decision and there’s no surprise when you find out that too many plugins, big images and bad url structure make your website slower than snail.

Leave a comment


  • George
    April 14th, 2011 / 5:57 AM

    Hi cool tips

    I like to ask you why not use in your blog what you recommend for url structure?

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this. Cookies are only used for statistical purposes.