14 Tips for Maximum WordPress Performance & Speed

The tips in this post are specific to WordPress. Before tackling the tips here, I advice you to implement as many related tips from my previous post. The previous post constitutes the foundation for this tutorial.

It is obvious, everyone hates a slow Website. Performance is a key factor for any successful Website including WordPress. Optimizing your WordPress Website for speed is not an easy process, it takes time to properly and safely make the changes. But before starting with any thing, make a full back up of your WordPress Website, this can be done by using the export function in your WordPress admin area.

How can you make your WordPress load faster? If you implement some of the tips outlined below, you will notice a dramatic improvement to your WordPress Website’s performance. Here are the tips and tricks that can be used to speed up WordPress and boost it’s performance.

Tools that Determine Website Speed

Run some of these tools prior to applying any of the speed/performance tips here in order to get a baseline metrics. Then make another run after implementing some of the tips below in order to measure the speed gain obtained.

  1. Website Speed and Performance
  2. Webpage Analyzer
  3. Google Page Speed – Mozilla Firefox plugin
  4. Yahoo! Yslow – Mozilla Firefox plugin
  5. Best Free Online Tools to Measure Website Speed

Tip0. Get a Fast Dedicated Web Server for Your Database

I added this tip on March 1, 2011. I felt that this is a very important tip, for you to seriously consider. From my own experience, whatever you do to make your dynamic Website load faster, if it is served slow, then there is not much you can do. In other words, if your database resides in a slow shared Web server then regardless how much you optimize your dynamic Website, it will still be slower than the average and you will not reap the benefits of your hard work.

How would I know if my database is hosted on a slow Web server? You can tell by the performance of your WordPress Website, your phpMyAdmin Web interface, and your WordPress dashboard. If these 3 are slow, sluggish and sometimes unresponsive, then what´s the common denominator between those three? you guessed it, your MySQL database. It is time to move your MySQL database to a much faster dedicated Web server.

Today, after the MySQL database of this blog has been migrated to a much faster and dedicated Web server, suddenly this blog loads in less than 2 seconds, which is 5-15 times improvement in load speed. Also my phpMyAdmin and my WordPress admin area are now very fast and responsive to user requests. So, if you implement all the tips below and you still not happy with your Website´s performance ask your web hosting company to move your database to a dedicated MySQL server. Believe me, you will be glad you asked.

Tip1. Keep WordPress Up to Date

You should always have the latest stable version of WordPress. Upgrading to the latest version is necessary because upgrades usually include performance and security enhancements and also new features. Go and upgrade to the latest version.

Tip2. Your Theme´s Choice

Choose a simple, minimalist theme for a faster load time. Choose a theme with a right sidebar which helps to load the content first. The theme should be well coded, valid for Web standards and accessible. Avoid themes that use excessive JavaScript or images.

If you think that your existing theme is slowing down your Website, revert to the WordPress default theme and test for speed. In this case you eliminate that your existing theme is not the culprit.

Tip3. Clean up Your Theme. Reduce the Number of Database Calls

In general, for each Web page, WordPress does the following:

  1. Compile the PHP code. More…
  2. Query the MySQL database.
  3. Create the static HTML file.
  4. Send back the HTML page to the browser.
  5. The browser, through HTTP requests, fetches all necessary components (JavaScript, CSS, images, Flash etc.) and displays the page.

#2 is a major cause of a slow WordPress Website: reading all the information needed from the database. This is where this tip comes into play.

Database calls is what makes WordPress dynamic. Reducing the number of database queries will lessen your server load and also speed up your Website. This is done by swapping dynamic properties with static ones. All WordPress themes include generic PHP code that can be easily replaced with static HTML tags.

Open the header.php file located in your current theme folder. What we need to do is replace some of the dynamic content with hardcoded static content. Since there is no reason for the theme to be portable anymore, we can replace those PHP queries with their corresponding static HTML code. For instance:

//In the header.php file. You could replace the 5 dynamic statements:
   <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
   <meta http-equiv="Content-Type" content="<?php bloginfo('html_type');?>; charset=<?php bloginfo('charset');?>" />
   <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
   <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
   <link rel="shortcut icon" type="image/x-icon" href="<?bloginfo('template_directory'); ?>/images/favicon.ico" />

//With the corresponding static ones that do not require database queries:
   <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <link rel="pingback" href="http://bacsoftwareconsulting.com/blog/xmlrpc.php" />
   <link rel="stylesheet" href="http://bacsoftwareconsulting.com/blog/wp-content/themes/indezinerpaperwall/style.css" type="text/css" media="screen" />
   <link rel="shortcut icon" type="image/x-icon" href="http://bacsoftwareconsulting.com/blog/wp-content/themes/indezinerpaperwall/images/favicon.ico" />

//If it exists, remove this statement for security reasons:
   <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />  

//Do not modify the title tag since wp_title() varies depending on what post/page is being viewed:
   <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>

You can also check for similar queries in the footer.php and replace them.

The best way to exactly know what you need to replace, is to compare your dynamic code at header.php and footer.php with your HTML source file.

Tip4. Become a Plugin Minimalist & Upgrade Current Ones

Plugins have tremendous advantages: they save a lot of time in coding and add a lot of functionality to your Website. However, I want to caution you about adding unnecessary plugins to your Website. Most plugins add a lot of extraneous code, and even create records in your WordPress database, thus increasing the load time of your Website.

Reducing the Number of plugins is one of the easiest tips to reduce your Website´s load time. Why? One reason is not all plugins are coded to load only when they are actually needed on the page. Ask yourself whether a plugin adds value to your Website. If it does keep it, otherwise delete it. Also make sure that you are using the latest version of the remaining plugins.

Did you know! You can just replace the functionality of many plugins by directly adding the code to your theme.


Tip5. Install a Caching Plugin

Caching drastically eases the stress on your server by saving and displaying static files for your visitors instead of making numerous queries to the database. This greatly reduces your Website´s load time.

There are several plugins to choose from, the most popular are listed below. My preference goes with the W3 Total Cache as it combines not only page caching, but also browser caching, database caching, object caching, compression, minification and CDN integration. But don´t take my word for it, feel free to try the other caching plugins and see what works best for your Website.


Did you know!

  1. If you are already using PHP speedy make sure to remove it prior to installing any of the caching plugins I mentioned above. PHP speedy can cause conflict with caching plugins. In my opinion a caching plugin far outweigh the benefits of PHP speedy. Caching plugin is a better choice and PHP speedy already passed its useful life.
  2. It takes time and effort to properly configure W3 Total cache because of the many options available. But one nice feature about it is that you don´t need an additional database caching plugin.
  3. If you decided to use the Hyper Cache plugin, also use with it the DB Cache Reloaded plugin, they complement each other and you will get a nice boost in performance.

Tip6. WordPress Trash Feature

In WordPress 2.9 and above, there is a Trash” feature added to the core code. This feature works like the recycling bin. A deleted post goes to the trash bin first. The bad thing is that you have to empty the trash regularly, otherwise your database gets bloated. By default the trash automatically empties every 30 days. You can modify that by adding the following line of code in your wp-config.php file located in the root directory:

//Empty the trash every 7 days
define('EMPTY_TRASH_DAYS', 7 ); 

Another method is to manually and regularly empty the trash from the WordPress admin area. Also, while you´re there, empty any spam comments too. Unfortunately, there is no constant that can be added to the wp-config.php file which automatically empties the spam (like: EMPTY_SPAM_DAYS). You still need to manually delete your spam comments from the WordPress admin area. Like trashed files, spam comments can take up some serious database space that need to be deleted on a regular basis.

Important! never use a Word processor like Microsoft Word for editing WordPress files but a text editor like Notepad.

Tip7. Disable Revision Feature & Delete Existing Revisions

WordPress 2.6 and above has a new feature which is post and page revision. WordPress automatically creates revisions of your posts or pages. Whenever you save a post or a page, the old version is retained so you can revert back at any time. Older revisions are never deleted so you always have a full history of all changes. However, this feature causes your WordPress database to rapidly increase in size. Depending how active your blog is, revisions can seriously bloat your database with multiple copies of the same post. Too many revisions stored in the database might cause longer query time and a slower loading blog.


Tip8. Flush the Buffer

When using the PHP flush function, you will slightly improve the speed of your WordPress Website. When users request a Web page, it can take up to 0.5 second for the server to display the HTML page. During this time the browser remains idle. The flush() function helps loading the partially ready HTML to the browser, while the server is busy with the rest of the content.

To insert the flush() function in your WordPress code, open the header.php file located in your theme´s folder and insert the single line of code immediately after the </head> tag.

<?php flush(); ?> //insert immediately after the head tag

If you use W3 Total Cache plugin in your Website, it is probably safer not to use the flush() function. I was using them both for several weeks and everything was working fine with no issues, but I decided to remove the flush() function just to be safe. I am not sure about the compatibility of the flush() function with other caching plugins.

This is from W3 Total Cache FAQ page: I see garbage characters instead of the normal Website, what´s going on here?
If a theme use the call php_flush() or function flush(), that will interfere with the plugin normal operation; making the plugin send cached files before essential operations have finished. The flush() call is no longer necessary and should be removed.

Tip9. Optimize your Database From phpMyAdmin

MySQL database does not clean itself up. Optimizing the database is an important step to speed up your Website. To optimize your database, you can either do this manually or use a plugin. I prefer manually, and no need for unnecessary plugins. To do this manually, log into phpMyAdmin. Find your WordPress database tables and select all of them. At the center bottom, click “Optimize table” from the drop down menu.

Optimize MySQL database from phpMyAdmin to make it faster.

ALWAYS backup your database before executing any SQL commands. You can create a backup copy of your database from phpMyAdmin with the Export function.

If you suspect a corrupt database first select “Repair table” then “Optimize table”.

If you don’t want to do this manually then this plugin is compatible with the latest version of WordPress (version 3.0.5): DB-Optimize

Afterwards, since you´re there …
After you deleted all unnecessary plugins and unused themes, there is a good chance that there are still orphaned data in your WordPress database. All plugins and themes use the wp_options table to store data. When you delete a plugin or a theme, some records are left behind. To clean these orphaned data, select the wp_options table and then the Browse option. Then go through the wp_options table record by record and delete any records that are left behind. Usually every record can be easily associated with a plugin or a theme.

I am assuming that you kept the WordPress table prefix as wp_. wp_ is the default but it can be changed to give your WordPress Website added security.

Tip10. Check For Exploits

Malicious code can seriously cripple your Website’s performance. If you notice a sudden increase in your Website’s loading time, it is worth checking for possible malicious injections. I suggest that you install one of the two plugins listed below and run a scan, after that you can remove it.


Tip11. Split Comments Into Several Pages

If you are getting lot’s of comments on your blog then it makes sense to split the comments into several pages in order to increase your page loading speed. This can be done from your WordPress admin panel by going into Settings -> Discussion. There is an option Break Comments into Pages with …, where you can set the number of comments per page. Also, you probably already know this, delete all comments that don´t add value to your post.

Tip12. Cache Gravatars

Gravatars are very slow to load. Every gravatar image is a new HTTP request. A page with 100 comments would have 100 additional HTTP requests, which cause a major slow down to your Web page.

If “Show Avatar” is enabled in your WordPress Admin area AND you are getting lot’s of comments then it makes sense to cache them locally.

One solution to speed up the page load time is to create a local gravatar cache, where images are cached and served from your server instead of the gravatar server. To do this you can use the Gravatar Cache Plugin. A second better solution would be to disable Avatars.


Practical Tips! (From your WordPress admin area: Settings -> Discussions)

  1. If you can afford it, don´t show Avatars.
  2. If not, set your default Avatar to Blank or to a custom avatar located on your server.

Unrelated but it helps! From your WordPress admin area: Settings -> Writing; keep Unchecked the option: Convert emoticons like :-) and :-P to graphics on display

Tip13. Use Excerpts and Limit the Number of Posts Displayed on the Main Page

Never show full posts in the main page. Let´s say you have 5 posts in your main page, and by showing every post in full, then it will take long time for the page to load. One way to reduce page load time, is to use the_excerpt() function.

Open the index.php file located in your theme folder and replace the the_content() function with the the_excerpt() function. Also you could do the same for archive.php and search.php files. (DO NOT TOUCH page.php or single.php files.)

//The '...' can be anything inside. 
//Search and Replace the_content() function
<?php the_content('...'); ?>

//With the the_excerpt() function
<?php the_excerpt('...'); ?>

Now the second step is to limit the number of posts being displayed on your main page. You can do that in the WordPress admin panel under: Settings -> Reading: as shown in the image below:

Post count on main Blog page from the WordPress Admin area.

Tip14. Split Long Posts into Several Pages

If you have a very long post, then it is best that you split the post into several pages. In this case each page will load much faster. Assuming that your theme supports it, all what you have to do is add the following quicktag in your post where you want the split to occur:


Where to check if the theme supports splitting the post into several pages? First you could add the <!--nextpage--> quicktag at the location where you want to split the post and see if it works. Also you should see something similar to the following code in your page.php, single.php and depending on your theme in either index.php or loop.php files . All these files are located in your theme folder. If you can´t find the wp_link_pages() function, then your theme does not support splitting the post into several pages. But you could always add this functionality into your theme.

//Something similar to this line of code should be in <em>page.php</em>, <em>single.php</em>, and <em>index.php</em> (or <em>loop.php</em>) files:
<?php wp_link_pages(array('before' => '<p><span class="strong">Pages:</span> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>

Some WordPress themes like Twenty Ten have an additional file called loop.php



That should do it for now. Hopefully, a few of these tips will help make your WordPress Website loads much faster and with maximum performance. If you know of more tips to speed up WordPress, please share it in the comment section.

If you enjoyed this post, please consider: linking back to it, subscribing by email to future posts, or subscribing to the RSS feed to have new articles delivered to your feed reader. Thanks!

About the Author |
Boutros is a professional Drupal & WordPress developer, Web developer, Web designer, Software Engineer and Blogger. He strives for pixel perfect design, clean robust code, and user-friendly interface. If you have a project in mind and like his work, feel free to contact him. Connect with Boutros on Twitter, and LinkedIn.
Visit Boutros AbiChedid Website.

23 Responses to “14 Tips for Maximum WordPress Performance & Speed”

  1. Pritesh Desai says:

    Hey Boutros,

    I came across your blog – 14 tips to make WordPress faster.

    My wordpress used to run a bit slow and I wanted to increase the speed especially for the homepage. Since I didn’t want a bad experience for first time visitors.

    So today I opened the homepage and saved the page with ‘HTML only’ option.

    I uploaded the file on my server as index.htm
    Surprisingly my website still works, including the inner pages and blog.

    Plus it is now fast… super fast.

    I would like to have your opinion about it, is it safe? Will something break in the future?
    I never thought it would work but surprisingly it did :)

    Please take a look at my site – http://inventikasolutions.com/


    • Hello,

      What you did is you created a static page from your dynamic pages.
      That what exactly a web browser caching and plugin caching do.
      With the exception that Browsers and plugins check if there are any updates on the page, and if so they refresh/update accordingly.
      But in your case, if there are updates in your page you have to do it again manually.
      If you don’t change your blog often, your solution would be fine and Probably in this case you should have a static Website and not a dynamic one.
      Static is always faster than dynamic, with some exceptions of course.
      Your slowness might be just the hosting company you are using.
      Hope this helps,

      Boutros AbiChedid

      • Pritesh Desai says:

        Thanks for the answer.

      • Pritesh Desai says:


        Unfortunately the contact form on the site didn’t work in this mode.
        I don’t know why. I’m using Contact Form 7 plugin.

        So for the time, I’ve gone back to the old way. Will research this issue properly.


        • Yes, I did not know you have plugins installed.
          The contact form plugin hooks to the PHP code of WordPress.
          The plugin would not process the form if you make the page static.
          You can always replace the plugin with custom coding to process the contact form,
          or you could use FormMail (http://www.tectite.com/) to process the form.
          Not sure what other plugins you have.


  2. Bryce says:

    I have gone through much of what is said and I’m not quite as technical, but tried some of the optimizations.
    My site is hosted by Hostmonster and they had a crash last week. Since then it’s been very slow once the query is made. It takes 20 seconds or so for the server to (using GTmetrix) respond to a file called xmlrpc.php. I can’t seem to open/edit it. Here is the response it gives in the timeline:

    Response Headers
    Thu, 28 Mar 2013 12:45:03 GMT
    Server: Apache
    X-CF-Powered-By: WP 1.3.9
    X-Pingback: http://www.westbendnews.net/autonews/xmlrpc.php

    text/html; charset=UTF-8

    I’m having a hard time with Hostmonster working to get this resolved. Once the response comes back (15-20 seconds) it loads very quickly.

    Thankyou for any info!

  3. bent says:

    I’m using your code for track post view in the wordpress theme.

    The problem is that when I use W3 Total Cache the track view is not working right.

    Is there a way in the W3 Total Cache’s Options to put ignore only on this function, but in the same time I want the code to work with W3 Total Cache?

    Thank you!

  4. [...] the image below, for an example of a spam pingback. What does my 14 Tips for Maximum WordPress Performance & Speed tutorial has to do with "Weight Loss Product Crystal Meth: Maximum Speed", I guess the [...]

  5. Shabir Virk says:

    I tried W3 Total Cache but according to me, Wp-Super Cache with DB Cache reloaded is the great combination to reduce the server load and serve pages faster.

    Using the option “Compress pages so they’re served more quickly to visitors. (Recommended)” also help to serve pages faster.

    I’m using a VPS (1GB Ram) and hosting my 4 wordpress blogs on it serving around 150000+ page views daily without any problem.

    Thanks and Nice Article :)

  6. Rajesh Namase says:

    Very nice tips, how to reduce no of plugins, how many plugins you have used in this blog?

  7. mumEngettetar says:

    A very valuable ideas.

  8. Ty Sind says:

    This information is great! Thanks.This has helped me alot!

  9. Joe says:

    Great post. In the past when I tried using one of the cache plugins, I found it to mess up some parts of the webpage that update. For example, Facebook like boxes, and feeds etc. I might give it another go because I think I was using a weird plugin, and it was a while back.

    Some people say that WordPress are just slow overall and there’s not much you can do to overcome this, other than change to html or whatever. Kind of wish I hadn’t built my site on WordPress now because my site takes forever to load…

    I think I’m just going to have to upgrade my hosting to dedicated, thanks for the good post though!

    • Thanks Joe for your comment. Tips 1 through 14 will help a little (or a lot depending on your blog). With Tip5 (caching) you will notice a significant difference.
      If you have some essential plugins that interfere with caching then you can’t implement this tip.
      If the plugins are not essential then probably you should remove them (tip4). W3Total Cache is very good, there is a learning curve but it is rewarding.

      Like I said in Tip0 (Get a Fast Dedicated Web Server for Your Database). If your DataBase is served slow there is a limit of what you can do and this is my personal experience.
      I implemented every tip mentioned in this post (and most of my previous one) for this blog, and if you are happy how fast this Blog loads then there is nothing wrong with WordPress. I know that static HTML pages in general loads faster than dynamic pages. If your website does not need to be dynamic, then I will go with static HTML Website. However, one drawback in terms of SEO purposes, google loves WordPress websites, the new content in WordPress websites shows up much faster in Search results than static ones. So there is a tradeoff you need to make.

  10. zvz says:

    The only notable performance growth for me was only caching. I use WP Super Cache, I will try yours recommended W3 Total Cache :)
    Thank you for nice tips!

    • Thank you zvz for your comment. WP super cache is good, but W3 Total Cache is more powerful. It all depends on your blog, WP Super cache might just be adequate for your blog.
      Pay close attention to Tip0 (Get a Fast Dedicated Web Server for Your Database). If your DataBase is served slow there is a limit of what you can do and this is my personal experience.
      Every other tip I mentioned in the post (besides Tip0 and Tip5) will help a little (and sometimes a lot) depending on your Blog.

      • zvz says:

        Agree, db is a week point of wp if there are 10k and more records. I have found also and heavy wp sites Calendar widget is what eats up very, very much resources (can be observed in slow.log).

  11. Thank you for this excellent guide, I’ve gone through all the tips and implemented them.

    I reduced my plugin number from 8 to 4 :)