How to speed up Wordpress

Of all the available CMS platforms WordPress is by far the most used platform of all. This is also one of the reasons there are many good optimization plugins and “tricks” available for it. The problem with WordPress is that it can get really slow when you leave it in its original install form without tweaking it, especially when a lot of plugins are installed along the way. All in all good reasons to list the best ways to speed this CMS up.

Test your website

Before optimizing your website it's a good idea to first test it with our website speed test. Using the test you can quickly see what the performance bottlenecks are and you can compare the before and after results when you are done optimizing your website.

Remove unnecessary Javascripts from header and footer

A standard WordPress template loads the Jquery library in HTML head of the public web pages even though in many cases these web pages do not actually need Jquery for anything. Also, sometimes badly coded custom template installs come with various Javascript files which aren’t used or necessary as well. These codes, most often found in the header and the footer, slow your website down because the scripts take time to load and the file loading also adds extra HTTP requests.
Make your way to the WordPress Editor (Appearance>>Editor) and click on the header.php link in the right sidebar. Make a backup of the code you see and experiment with removing all (yes, all) of the Javascript files to see whether it affects your web pages. Experiment with removing every script one by one and only remove the scripts which do not affect your website. Now open the footer.php code in the editor and do the same. Remove as many files and scripts as you can. The lesser the better.
Again, remember to always make a backup of your the header.php and footer.php code before you remove anything so you can add the old code back in when removing a Javascript file does affect your website.

Use a cache plugin

Every time a visitor loads a page on your website WordPress looks for the freshest version of that page. This means it has to continuously load the database to retrieve this fresh information. In most cases the loading of the database is totally unnecessary because most pages do not change often after they’ve been created. A cache plugin fixes this problem by making a static copy of your web pages and delivering it to your visitors without loading the database with every visit, also known as caching. This can speed up the loading times of your web pages significantly.
One of the best plugins is WP Super Cache. W3 Total Cache is a great plugin as well. There are various other cache plugins that you can try out as well.

Use WP Optimize

WP Optimize is a neat little plugin which helps you clean and minimize your WordPress database. You can optimize and clean your MySQL database, empty the trash, remove post revisions, delete spam comments, remove pingbacks and trackbacks with one simple click of the mouse. With some websites it has reduced the database size by 80% or more. This improves the performance of your website since Wordpress databases clog up and become inefficient over longer periods of time. Use this plugin with caution, do not clean/delete things you aren’t sure of.

Enable browser caching in the .Htaccess file

Browser caching enables you to save the web files of your website to the hard disk of your visitors. Now every time the visitor visits another one of your web pages these web files will be loaded from their computer, which speeds up the download process and greatly improves page speed.
More information about caching to make your website faster can be found here.

Enable gzip compression

Enabling gzip compression will compress your web files to a compressed gzip file before they get sent to the browser of the visitor. Gzip can compress web files to as much as 80% of their original size. This compressed version of your web files that is sent to the visitors browser (all browsers support gzip) will be decompressed by the browser to load the original full file again. This will speed up your website because the gzip file is smaller in file size as the original page and therefore your visitors have to download less kilobytes. Go here to find out how to enable gzip compression. To enable gzip compression in WordPress you simply visit in your browser, find the gzipcompression setting and change it from 0 to 1. Use the gzip Compression Test to check whether it works.

Minimize the number of social media buttons

Every social media button (Facebook, Twitter, etc.) requires the browser to load all the necessary web files (like button images) that come with it. This can add a lot of extra HTTP requests. When you insist on using the buttons you should always host them on your own website.

Minimize plugins & disable slow ones

Some plugins can decrease the loading speed of your public WordPress web pages. Uninstall plugins you do not need to minimize this problem. Always test a plugin before you use it. When it slows down your website try to find a different way of fixing the issue the plugin helped you with in the first place. Use P3 Plugin Performance Profiler to detect which plugins are slowing your website down.

Optimize your images

By minimizing the file size of your photos and images you can speed up the load times of your web pages. There are various tools to do this. To optimize PNG images or JPG images you can use the PNG Compressor or the JPEG Compressor, sometimes it can reduce the size by 50% or more. One of the most popular plugins for WordPress is the EWWW Image Optimizer plugin. This plugin uses well-known image compression techniques(optipng, jpegtran, pngquant, pngout, and gifsicle) with a simple click of the mouse. There are also other good plugins available like WP

Use CSS image sprites

Most websites use a variation of images in the design of the template or for certain functions. Every time these images load on your web page it adds extra HTTP requests. One way to minimize the number of HTTP requests is to use CSS sprites. CSS sprites give you the ability to combine several images into one while still being able to use them individually in different places on your web page by using X and Y coordinates defined in a CSS script. This way you only have to make one HTTP request to load multiple images. Use the CSS Sprites Generator to create the sprites and read the instructions to place them on your site.

Lazy load photos

You should lazy load your photos for a faster visitor experience by improving the rendering of the above-the-fold content.

Inline CSS & Javascripts

Inline your CSS scripts and Javascripts to speed up the rendering of your web pages.

Can’t inline? Combine all CSS or Javascript files to one big file

For help on how to handle Javascript files when it comes to page speed go here. About CSS files: Most WordPress themes load multiple CSS files, sometimes as many as 10 or more. This adds unnecessary HTTP requests which can affect website performance. Copy the scripts of all the CSS files and add it to one CSS file. Now go to the WordPress Editor, open the header.php code and replace all the CSS lines with one CSS code which points to the big CSS file. You may have to edit the wp_head function to achieve this. When you are able to edit the header copy the script from the big css file and place it inside the header in style tags like this: <style> the CSS code </style> You can also use the CSS Compressor to minimize the size of your scripts significantly. Make a backup of your script before you use this tool because it changes the structure of your script to make it the smallest possible.

HTML Minifier plugin

Use a plugin that can automatically minify HTML pages for you. A great one is WP HTML Compression. It works great on most websites and has very few bugs. Test it on your own website to see whether it works for you.

Asynchronous scripts

Using asynchronous scripts will decrease the load speed of your website because the loading of the scripts will not interfere with the loading of the page. In short this means that even if these scripts load slowly your web page can finish loading and be seen by your visitors without loading the script first. See here for more information.