Welcome to this short guide on how to improve your WordPress speed performance. We will cover a number of steps that should help you improve the loading time of your site by reducing the number of requests pages make, reducing server response time, and reducing CPU utilization. In our previous blog we already stated what is WordPress page Speed. In this article we will cover a range of measures to improve your WordPress Speed Performance.
1. Install a caching plugin
The first step to improve WordPress speed performance is to install a caching plugin. We recommend WP Super Cache or W3 Total Cache, but some good alternatives include Hyper Cache and WP Rocket. Whatever you do, don’t skip caching! If you don’t have a caching plugin installed, you will see the biggest gains by adding one of these to your site. Caching will allow visitors to your site to view pages from your server in a fraction of the time it takes normally.
Whatever you choose, make sure that you set up permalinks correctly for WordPress and use either mod_rewrite or .htaccess for Apache if necessary so that URLs generated by WordPress don’t have query strings attached. If you don’t do this, the site will spend an additional second executing communications to a web server for every page view. This will add up over time and is likely to be significant. You can read more about mod rewrite for Apache here.
2. Install a good theme
If you’re a WordPress newbie, we recommend a theme from Themes Directory or Ultimate CSS Theme Gallery. For even better performance, consider using a premium WP enterprise theme that has been professionally built with WP-Optimized. These themes are for companies and personally hosted sites which are managed by companies – if you have your own WordPress site you can use any theme.
Furthermore, look for an active community backing the theme as there appears to be some correlation between themes with large user groups and faster load times in general.
3. Optimize your theme files
4. Optimize plugins to increase Speed Performance
The next step is to optimize and/or disable any or all of your plugins to see how much you can speed up the loading time of your WordPress site. There are thousands of WordPress plugins out there, some good and others terrible. There have been some recent studies that look at speed differences between featured plugins and premium paid ones. Some of these show that premium WordPress themes can actually increase page load times if one or more quality free plugins are not installed. Some others show that premium plugins can increase page loads by up to 50% with no effect on theme performance while others show the opposite pattern – fast themes beat slower ones.
Unfortunately performance may vary depending on how a plugin is coded. For example in this article we show how to optimize WooCommerce, one of the fastest WordPress plugins available today. There are likely many similar examples out there so it is worth looking into any plugins you have installed and looking at their source code.
Another factor to consider in optimizing plugins is that they can over-use CPU and memory resources when they run simultaneously on multiple pages. This can result in poor performance on some machines with limited resources, especially older ones without multicore processors and RAM. For this reason some plugins are better tested individually rather than as part of a theme package. If you are running any WordPress theme packages, make sure the individual themes do not interfere with each other for the same reason.
5. Improve server response time
You can also try asking your web hosting provider for assistance to look for ways of improving server response time to improve your WordPress Speed Performance. This is a big factor in site speed and if you have the choice between providers, some are better than others. In general, VPS or dedicated servers will be much better than shared hosting and cloud hosting will be better than VPS or dedicated if you’re looking to maximize performance. Asking a knowledgeable technician how to optimize W3 Total Cache plugins may also be worthwhile.
6. Optimizing the template file
7. Optimizing WordPress code (themes)
Finally you should look at how you can improve your WordPress theme or plugin code to see how much you can speed up the loading time of your WordPress site. Some factors that come into play here are code structure, performance optimizations and refactoring.
In WordPress itself, it is possible to use a template file (for example site.php) that registers all necessary files automatically. You can also use a custom hook or a plugin (see WordPress Hacks) to register all files at the very start. Another way is to register all files automatically when a hook is fired. Hooks are described in more detail in Hooks and Filters.
When you change your theme, you should look into the panel that was launched when you updated the theme – it may not be obvious what to look for here but often there will be something there that looks like other themes that share similar functionality – for example if you have several tabs like Home, About Us, Services and so on, this can mean you’re using WordPress’s default theme which is optimized for one page but not split across several pages.
In any case, it is usually possible to move the content of each page into its own separate template file that uses a template tag and sometimes a conditional tag depending on whether the file has been downloaded before or not. This can produce significant gains in site speed especially if you combine this with CSS loading techniques and PHP include files as described above.
8. Remove unused plugins or themes to improve WordPress speed performance
If you have an old theme or plugin installed, remove it if you think it is slowing down the load time of your site. If some of your plugins are incompatible with others, you should try and fix this problem first. If you can’t, try and remove the incompatible plugin(s). Some plugins slow down your site due to the way they are coded. Others conflict with each other. To test this, remove all plugins one at a time and see if there is any improvement in load speed.
If you have removed a lot of plugins and not yet improved your site’s load times significantly, then it may be time to move on to the next step..
9. Move your site to another webhost / server
If everything else has failed, it may be time to consider taking your WordPress site off your current web hosting service provider and moving it elsewhere. Although this will be time consuming and usually involves a migration to another server (i.e. downloading of database, files and images), it may be well worth it. This is especially true if you are on a shared server with low resources or if frequent updates to your WordPress site have caused problems with your current hosting provider’s server or web application stack (see also #5 above).
Sometimes moving a site to another server can improve its load speed without requiring any changes other than moving it and having everything reloaded on the new server. In any case, you should test your new site before you go live with it, and if you find that it doesn’t improve your load time significantly, don’t forget that all plugins and themes can be updated relatively easily – in some cases they may even be compatible between both sites so there’s no need to update the whole site again.
10. Use CDNs or static content delivery networks
Another way to improve performance is by serving all static content (files and images) through a CDN – this may look odd but it’s really not as difficult as it might at first seem, and it may cost you far less than provisioning your own server just for static files.
11. Add an HTTP cache to improve WordPress speed performance
An HTTP cache is a series of computers and servers that store copies of resources on your site so that users do not need to download them every time they visit. Normally, if you own your own server (see #5 above) you can easily add an HTTP cache by using a plugin like WP-Super Cache or W3 Total Cache Reloaded. If you don’t have your own webhosting account, then there’s no alternative but to use a service like this.
12. Add PHP caching to improve wordpress speed performance
PHP caching is quite similar to an HTTP cache except it works on the server side instead of on the client side. Because of this, it is more efficient than an HTTP cache in almost every case and can reduce the load time of pages that have already been downloaded substantially. You can read more about PHP caching here on W3 Total Cache or here on W3 Super Cache Reloaded.
13. Serve your site via a CDN (Content Delivery Network)
CDNs allow you to serve your site from a network of computers around the world instead of just one or two servers depending on which country they are in and where their visitors are located. The benefit is that if you are serving a lot of visitors (e.g. to the USA or UK) then the resources you need to serve pages may be installed on servers all over the world – this will significantly improve your WordPress Speed performance and make it so that users will be able to download pages much faster than before.
If you are using WordPress with a cache plugin, then it is recommended that you use Cloudflare or Fastly as your CDN provider (although you could use other providers too). Here are a few tutorials on how to do this:
14. Test if your website’s code is optimized for speed and avoid code duplication
There’s no point in optimizing a site if the code that runs it is of poor quality and unnecessary, or if there are multiple copies of what you really just need to have on one page. Avoid duplication of code by using as little as possible, which means eliminating all unnecessary plugins, themes, scripts and so on. The less code you have running on your pages the faster they will load – however even this approach may not be enough sometimes so be sure that everything is optimized for speed first.
15. Use the Windows Error Reporting tool
When you encounter a problem with your site you may be able to get a human to help you with it, but if the problem is caused by the code that runs your website, then fixing it involves a lot more work than just having someone read the code and pointing out where you did something wrong. That’s why it is good practice to check in your browser’s error log file that is generated when something goes wrong on your site.
A browser log file is generated when your browser encounters an error and saves it to a temporary file on its hard drive or sends it to the server. You can access the error log using most web browsers and sometimes if you search for a specific error message in Google, your browser will show you what was wrong when it encountered that error.
But if you use the Error Reporting feature in Windows, then every time something goes wrong with any of your websites code, this log is saved automatically for you so you can be sure that no one has overlooked anything important.
16. Use the console to make your code more efficient
The console is a part of the HTML specification that enables you to set global variables and run code without including it in a page. This can be pretty useful if you need to create a lot of code on one page – you may want to do this in order to optimize it for speed. However, be sure not to use it too much otherwise you may run into problems when debugging your site or loading your pages.
17. Use a slow server to make your site load faster
The speed of any resource you try to access on the web is calculated by a number of different factors: how fast the data was sent from the server, how much time it took for the data to be received by the client computer, and how long it took for any subsequent processing by the browser. All 3 of these factors are important and have an impact on speed.
Usually, a faster server will result in an overall faster site performance, but there are occasions when this may not be true – e.g. if you’re hosting your site on a shared host. If you run a performance test and notice that the server is too slow (or too fast) for your site, then you may want to switch to a different type of hosting for your site.
18. Use “async” – this will allow your scripts to load when it makes sense
The async attribute was created by Microsoft and is part of their HTML5 specification. It is used primarily to ensure that when a script loads it does not block anything else from loading on the page, e.g. images or other scripts. The purpose of async is to prevent the browser from waiting for the script to load before it processes the rest of the page.
19. Use “defer” – this will make sure your scripts load in a specific order
The defer attribute was created by Microsoft and is part of their HTML5 specification. It is used when you need to load multiple scripts on one page and want to be sure that they’re loaded in a specific order. The purpose of defer is to prevent the browser from processing any code before it loads its scripts (which are loaded asynchronously).
20. Use “compress” – this will reduce the size of your images
The compress attribute was created by Google and is part of their HTML5 specification. It is used to compress an image before it is sent to the browser. The value for compress can be set to “gzip” which will result in the image being compressed using GZIP algorithm, or you can set it to “image” if you want the browser to use whatever method it normally uses.
21. Use “preconnect”, “dns-prefetch” and “preload” – these will help with your site’s speed and make it more secure
The prefetch resource hint has been implemented in Chrome since version 4.1 and is used to speed up a website by sending off data that the browser does not yet need in order to avoid having to wait for it. It works by sending the browser data that will be required later, in advance of its being needed on the page – this is known as “prefetching”.
The preconnect and preload hints are used to prefetch content that a website may need prior to when it becomes available on the page. The advantage of using these resource hints is that they do not require any kind of extra server code to take effect – your web host or CDN provider automatically responds with a message saying they’ve received your request.
This feature is not available in all browsers, but it may be useful if you have a site that uses content that is less likely to be used on every page – e.g. if you have a site that provides information about local businesses, you can use preload to load the map of the area prior to when it becomes visible on the page.
Finally, if you use CDN’s with your website and don’t want to load the content from the CDN server before your site is ready, then you should set up “preconnect” so that it loads the content when it is first requested on the page. In this way you improve your WordPress Speed performance.
22. Use “scroll” – this will help make your site faster
The scroll-to-top and scroll-to-bottom attributes were created by Apple and are part of their HTML5 specification. These attributes ensure that when a user scrolls down / up a web page to reveal new content, they remain at that position in the window regardless of where they’re currently located on the page. This is particularly useful for long web pages – if you have a lot of related content on one page, then a user may scroll past it.
When adding this attribute to your site you need to be careful that the content doesn’t move too quickly – e.g. if your website uses scrolling for navigation, using the scroll-to-bottom attribute will cause your users to accelerate as they reach the bottom of the page. The solution is to use a delay between 1000ms and 4000ms so that it slows down their scrolling speed as they reach the end of the page.
23. Use “marquee” – this will help make your site faster
The marquee attribute was created by Apple and is part of their HTML5 specification. It allows you to create an element that animates in a large arc (rather than a circle) on demand. The effect is similar to something like the progress bars in Windows Explorer – the marquee animates either side of the area where it’s located.
Outline Improve WordPress speed performance
After doing all these important points above about Improve WordPress speed performance, you should be able to present a more pleasant user experience. If you’re stuck with an unstable host, a slow server and slow scripts, then let Our Increase WordPress Speed Team help You!
If you enjoyed this article, please share it by clicking the buttons below. If you have any questions or comments then feel free to leave them in the comment section below or in our Facebook Group – I’d love to hear them!