It’s important to know how to speed up WordPress site for two main reasons. The first is to prevent your visitors from leaving too soon due to long load-up times, and the second is that this is one of Google’s ranking factors. The loading speed of any website, whether a blog or a regular site, can be a critical factor in your success – or your failure.
Many know that WordPress is an excellent platform for building a blog but keep in mind that you can also use it to create a regular website. It is a complete CMS (Content Management System) that is easy to install and easy to customize to your own preferred look and feel.
Even for those that know this, they may not be using WordPress to its full potential and be unaware that their blog or website is not performing as well as it should. A major aspect of any site, whether it is a blog or standard website, is speed. The loading speed of a WordPress site is one of Google’s ranking factors, and your visitors will want to transition between pages and posts as fast as they can.
Here are some tips on how to speed up a blog, maximize its potential and show your visitors that you are a professional blogger. Depending upon your level of expertise, you may already be applying some of these tips, but few will be using them all. So let’s go with an obvious one to most bloggers: caching.
#1. Choose a Good Web Hosting Service
Speeding up a WordPress site starts right at the beginning – with your choice of web host. There are many hosting services available, some free some not free, some good and some bad. Never try to get a cheap web hosting service at the expense of quality.
Free services are not worth the money! If you want to run a good blog and have control over your content and they way it looks and operates, you won’t get that with a free web hosting service – or even a free blogging service. Take our advice on choosing the best web hosting for your blog – if you want to own it, design it and run it as you wish!
A good web host has powerful servers that will not crash when it receives high volumes of traffic. It also offers high security for your data, and an excellent Control Panel that allows you to run your blog or website with the minimum of fuss. There are many available, although we recommend Bluehost. Check out our article “Web Hosting Services, Find the Best Web Hosting” for more details on choosing a good web hosting service.
#2. Caching and What it Does for You
A cache loads recently visited web pages (including blog posts and static pages) to local memory on your own computer. When such pages are requested, they are provided immediately from cache – assuming that no changes have been made to the content meantime.
A computer’s cache stores files, images or even entire web pages. When a visitor to your blog clicks to another page or post and then clicks to go back to your Home Page, this would normally involve the information being requested from the remote server. The request has to travel to that server’s location and then the information requested has to be retrieved from that server and delivered to your device – whether that is a regular computer, a laptop, a tablet or a mobile device.
That can take a great deal of time, particularly if you, like most bloggers, are using a shared hosting service. That means you are sharing a server, and your request could be very slow if that server has to handle many requests at the same time as yours. A cache can prevent this waste of time.
- Your visitor reads your Home or Landing Page.
- Your visitor then clicks to a post on your blog.
- You visitors at some time later wants to visit your home page again.
- That request is sent to your server which extracts your static Home Page and provides it to your site.
- The visitor waits for that page to be reloaded and can then can view it.
- Your visitor reads your Home or Landing Page.
- Your Homepage is copied to your cache.
- You visitors at some time later wants to visit your home page again.
- The visitor immediately served with that page from your cache.
Fundamentally, that is how a cache works to speed up WordPress sites. It saves a great deal of time, and the cache will save all pages or posts accessed by your visitors. If no changes are made to these pages, then the contents of the cache will be provided to anybody clicking on that page’s URL. If there was no cache, the URL would be sent back to the server which would then seek out the information and provide it.
Caching saves time in accessing previously visited pages online which have not been changed since your last visit. By installing a plugin, such as WP Rocket or W3 Total Cache, dynamic web pages are converted to static web pages that can be stored for later access. This saves a great deal of time in navigating your site and can even avoid crashes when servers are faced with a large amount of traffic – caching avoids the need to use the server.
#3. Limit the Posts on Each Page
If you display the full text of every post on your first page, then this could take a long time to load. If you want to make your WordPress site faster, then restrict how much text to show in each page, particularly if images or videos are included.
Go to Dashboard->Settings->Reading and you will see this part of the screen:
Set this from the default to how many posts you want to be viewed on the screen at any one time. Five is enough, and you may even reduce this to four. The default will likely be 10 – that is far too many and will take time loading.
If your posts are generally short, then you can show the entire text of each. However, when discussing how to speed up the WordPress site, it is wise to only include a summary with a click to read the rest of the text. Once the visitor has read it all, they can get back to the Home Page with another click. One of the tricks of speeding up WordPress is to provide short information bites with links to the entire text.
#4. How to Speed Up WordPress Site with Short Posts
If you are writing a particularly long post, then it pays to split this into more than one post – or into different pages. You may have a long report or guide to publish that involves multiple links, images or videos. This will slow down the site significantly – so much so in some cases that your readers will get bored waiting for it to load and click away.
There two main ways to deal with this:
- Split it into a number of parts with a link to each part, or
- Split the post or page into different pages. Use the text
<!--nextpage-->to separate each page. Most WP themes or templates offer a way of doing this (see Section 4).
If not, the easiest way is simply to write a screen at a time then provide a clickable link at the bottom to go to the next part. This speeds up the loading of the first page of the report or guide, and your visitors won’t notice the time taking to click to each part. It could be that a 10-page Guide takes just as long to load as the sum of each of the parts does, but the latter is less noticeable.
#5. Limit the Length of Post Text on your Posts Page
If you display 5 posts at a time on your blog page, this can take a long time to load if your posts are lengthy. Instead, display a part of the post and offer the reader a link to click to read the rest. There are two ways to do this in WordPress:
a) From the Editing Screen on a Front Posts Page
This works if your Front Page displays your latest posts. It does not work if your Front Page is a static page, and does not work on individual ‘Posts’ pages.
If your Front Page is used to display your latest posts, then check out the menu bar in ‘Visual’ mode:
The red arrow is pointing to the ‘More’ button. Simply place your cursor at the end of the text you want to be shown, then click that button. The text ‘Read More’ will then show, which when clicked will lead the reader to the rest of the post which is stored on a separate page.
You can edit the ‘Read More’ text to suit your post if you prefer. Change the toolbar from ‘Visual’ to ‘text’ mode. You will see the ‘Read More’ text at the bottom of your post. Change that text to whatever you want it to be. For example ‘Click Here to Read the Rest of this Post’.
b) Use Excerpts
The above method works well if you are using your Front Page to display your latest blog posts. It does not work on internal posts or static pages. For individual blog pages, you can use excerpts if your theme supports them. This enables you to write a short passage introducing the post and a link is provided to the rest.
There are several plugins available to generate excerpts for pages and individual blog posts. Go to Dashboard->Appearance->Plugins->Add New then use the search facility to look for available ‘Page Excerpt’ plugins. Check they are suitable for your version of WordPress.
#6. Use Smaller Images to Speed up a Blog
You can speed up a blog by using smaller image sizes. By smaller, we mean images with smaller file sizes rather than just images with smaller dimensions. The higher the resolution of your images, the longer they will take to load. Try to use .jpg formats where possible – they are much quicker to load than the common .png or .gif formats.
If you are using images as a secondary function on your blog, such as to demonstrate how to carry out tasks such as we are using on this blog, then the image quality does not matter. However, if you are a photographer showing your work, then likely a ’lossless’ format such as .png, .tif, .lzw or .gif would be necessary, but take longer to load.
Regarding the physical dimensions of images, use only those dimensions needed to display what you want to be seen! That means if you can do this with an image of 20 mm wide then why use one that takes up the entire width of the page!
There are plugins available to reduce image sizes with the minimum loss of quality – these are not physical dimensions but the byte size of the file. One of these is WP Smush It which removes unnecessary information from your images and compresses them to take up less file space and hence load faster. Check out the WordPress New Plugin section of your Dashboard for others.
#7. Reduce Hotlinking
If another site wants to display a particular image, it is possible for it to link directly to an image on your blog using the URL for that image. This is known generally as ‘hotlinking’ and the person doing that is in effect stealing your bandwidth. This is because when the other site is loaded, or a visitor to that site accesses the image, it calls the image from your server which in turn can slow down the operation of your own blog or website.
If another site copies an entire post containing several images, and that site has tons of visitors, your server may not be able to handle all of these image requests. Imagine the situation if this was being carried by many other spamming sites! The speed at which your own blog could access these images from your server would be significantly reduced. You have to stop this happening – and there are ways!
a) Go to your root .htaccess file. You will find this in the file structure on your web hosting service.
b) Go to your domain directory and find the .htaccess file. This is a text file you can edit using a text editor. Add the following text to the file:
#disable hotlinking of images with forbidden or custom image option RewriteEngine onRewriteCond %HTTP_REFERER !^$ RewriteCond %HTTP_REFERER !^http(s)?://(www.)?wpbeginner.com [NC] RewriteCond %HTTP_REFERER !^http(s)?://(www.)?google.com [NC] RewriteCond %HTTP_REFERER !^http(s)?://(www.)?feeds2.feedburner.com/wpbeginner [NC] RewriteRule .(jpg|jpeg|png|gif)$ – [NC,F,L]
Then save the file.
If you wish, you can create an image that will come up to tell spammers that stealing is not permitted from your site – or something similar. Maybe even a gif similar to that in Jurassic Park that waved a finger at those trying to break into Dennis Nedry’s computer! Make sure you ‘ Allow’ your feed, or visitors will see no images.
#8. Setting Expire Headers
Another way how to speed up WordPress site involves setting expire headers. Once it became known that site speeds would impact on Google rankings, so-called ‘SEO experts’ came up with many ways of improving the loading speed of a website or blog. Setting ‘expire headers’ was one of these.
So what is an ‘expire header’? It is connected with caching. It tells your browser what content should be cached and what can be accessed from the source server. Large jpeg graphics, for example, may be cached and save being sourced and delivered from remote servers. This can save a lot of time and speed up the presentation of your blog site as a whole.
An ‘expire header’ tells your browser when to cache content should expire and when it should be accessed fresh from the server. If your images or any other form of content does not change over long periods of time, then expire headers can save loading time and speed up the operation of your blog.
To set them, go to your root .htaccess file and add the following code:
ExpiresActive On ExpiresByType Image/jpg A2419200 ExpiresByType Image/jpeg A2419200 ExpiresByType Image/png A2419200 ExpiresByType Image/gif A2419200 ExpiresByType Image/tif A2419200
The number 2419200 is the number of seconds in 4 weeks. You can set this to whatever you feel is a safe period of over which you will not change your images or other cached content. The danger is that if you set too large a time period, your visitors will not see new images or other relevant cached content. They will receive old content and think your blog is not being updated.
Get it right and you can save a great deal of loading time, and also the transition time between posts and pages.
#9. Speed up Loading with a CDN System
A CDN System, short for Content Delivery/Distribution Network, is a network of servers that provide you with the maximum loading speed for your blog. CDN enables visitors from anywhere in the world to get the fastest loading speed by being directed to the server nearest to them.
For example, most web hosting services based in the USA use American-based servers. It takes time for a request from the UK or Asian client to reach that server and then for the requested files to return to the client’s device (computer, laptop or mobile device). This increases the time taken for a visitor to see the information they want.
Registering with a CDN service enables Asian or European users to access such files from servers local to them. The same is true with European websites and blogs. American users can register with a CDN service and receive European files from local American servers.
MaxCDN: With CDN, users are normally connected to servers within their own country. You can register for free CDN services, although the maximum benefit is obtained from paid services such as that offered by MaxCDN, a very fast worldwide CDN service. This costs $79/month per terabyte, but there are less expensive options available for the less professional blog sites.
You don’t need to know anything about CSS to minify the files by reducing unnecessary white space in the coding. There is a difference between compress and minify: that latter means to reduce the code to the minimum needed to achieve the desired result and remove unnecessary white space. Compressed files have to be decompressed before they can be used.
There are several WordPress plugins available that can achieve either of these ways of reducing file size but read the instructions carefully. Sometimes these can remove any customizations carried out using CSS. Go to the Plugins section of your dashboard and search for “CSS compression” – check each one and read the reviews, both negative and positive before installing and activating. This can speed up your site.
A good plugin is Better WordPress Minify. This is available from the WordPress plugin directory here: https://wordpress.org/plugins/bwp-minify/ It comes with official documentation and ‘best Practice‘ advice on using it.
- Removes any white space not needed for the code to execute, and thus reduces load time because white space has to be scanned during loading.
- Shortens identifier names where this would make no difference to the execution of the code.
- Removes comments that many coders add to explain what each section of the code is for. This is not needed to load the code!
There are other benefits of minimization that genuinely speed up the reading and execution of the code.
- Removes nothing from the coding
- Regenerates the original coding in its entirety when uncompressed
- Must be uncompressed, unlike minification.
When you compress a file, the software executing this changes repeated data strings into code which can then be used to regenerate the original file. Thus: the data or code string aaaaaabbccccccc would be compressed to a6b2c7: 14 original characters compressed to 6. For the string to operate, however, it must be decompressed to read as the original.
You can speed up your site if you use either of these methods – or even better, use both together which is what some plugins can do. Most find that minification is fine by itself, because compression/decompression takes two steps although the time differences involved are very small.
#11. Edit your WP Theme
You can save loading time by carrying out some very simple editing to your blog’s theme:
- First, remove the statement of the WordPress version you are using.
- Remove the ‘Powered by xxxxxx’ or any other such text.
- Make your blogs name and tagline static.
- You can also make the URLs for your stylesheet, pingback and feed static.
Each of these sends a query to the database, and by removing or making them static you can remove these queries, and hence save time.
You can also check your theme and remove some of the default information in the footer, such as:
- The name of your blog – this is not necessary in a footer.
- URL of your RSS feed if any.
- URL of your Comments feed.
- “Powered by ….”
- “If you would Like to Support WordPress. . . “
- Any other Footer information you see in your theme that is not needed such as the theme name.
It’s amazing how many bloggers keep all this information, much of it no more than advertising. All of this has to be loaded and it takes time to do so!
#12. Use the Right Plugins – But Not Too Many!
Plugins are there to help customize your blog your blog to operate as you want it to. They can be used to provide menus, opt-in forms, reduce spam, and carry out many functions behind the scenes including speeding up the loading and navigation speed of your site – and slowing it down! Yes- plugins can slow down the operation of your blog.
If you have too many plugins running, then they consume bandwidth and space – so they can slow things down. Every activated plugin starts working as soon as your site is live. If you have plugins that are doing nothing for you then they are needlessly using up resources – which slows uploading and transition times.
For Coders: If you include a plugin in your template files to thank people for visiting your site from Google or another search engine, you may use coding like this:
<?php refer_thanks(); ?>
This is OK and rightly gives a ‘thank you’ to visitors to your blog. However, if this plugin is deactivated for any reason, by design or accident, the function cannot be found and your page stops loading. To overcome this you should include the function_exists function. This returns TRUE if the function has been previously defined. So replacing the above line of code with:
<?php if (function_exists('refer_thanks')) refer_thanks(); ?>
The function has been defined, and your blog will not break and fail to load. It might be a good idea to make this change for each line of code in such plugins.
Make sure that every plugin you have activated has a purpose! Not only that, but that the purpose is useful to you and not just ‘good to have’ or ‘just in case’! It must exert a positive influence on your blog otherwise get rid of it!
If you need a specific plugin only at certain times, then activate it only when you need it. Delete any inactive plugins you are not using. Try not to use more than 15 activated plugins – more than this should be unnecessary and will have a significant effect on blog loading speed.
You can check the performance of your plugins using this Plugin Performance Profiler: https://wordpress.org/plugins/p3-profiler/
Many blogs have thousands of tags. These take time to load when they may each be attached to thousands of posts! Imagine 1,000 tags attached to each of 1,000 posts – that is 1 million combinations which must be loaded.
Get better at rationalizing! Make sure you only apply tags to posts that are relevant to them. Look on Tags as ‘keywords’ that visitors might use to find specific information. If your post does not provide good, relevant information on a specific keyword (tag) then don’t use it for that post!
You might have 20 posts focusing on blue widgets, but simply use blue widgets for posts on all widgets that might use blue widgets in a sentence or so! Drill down more and use tags to make it clear to visitors what each post is about – not in general terms but specifically. Reduce your tags for each post and you will reduce the loading time for your blog.
You will also keep your visitors happier by giving them information focusing on their search!
If you have a very popular post or page on your blog, then you may get more comments that are healthy for your site. Hundreds of comments are great – they show a great deal of interest in your post (assuming they are not spam!) – but they also take a great deal of time to load. What do you do? You want the comments, but you also want to speed up your site or you will lose visitors.
Split your comments up into pages! That’s right – you can easily break your comments into pages with specified numbers of comments per page. Here’s how:
Go to Dashboard => Setting => Discussion and you will see the following options:
This enables you to set a number of variables including the number of Comments permitted on each of the pages and posts on your blog. You can set it at 35 as above, or restrict it just 5 or 10 – any posts above your set number will be published on separate pages.
You can also set the level of nested comments (comments about comments) and whether you want the first or most recent comment to show at the top. Reducing these can also significantly reduce the loading speed of your blog.
#15. Increase MySQL Query Speeds
WordPress stores data files in a database system known as MySQL. Every time your blog is loaded – by yourself or visitors – WordPress executes multiple database queries where requests are made to the database on your web server, and the results are then returned to the device requesting them. That device can be your own computer, a visitor’s computer or even a mobile device such as a tablet or cell phone.
All of that takes time, and the quicker such database queries are handled the better. Many of the suggestions provided above will reduce database calls, such as making certain aspects of your blog’s content static – your feed URL for example and removing your blog’s WP version. However, you can also optimize the database itself to increase the speed of supplying the requested information.
You can do this manually:
- Go to phpMyAdmin on your Web Hosting Control Panel and log in.
- Select the relevant database
- Right at the bottom see Check All
- Click on that and all the tables should be ticked/checked
- Click the drop-down menu towards the center of the screen.
- Click ‘optimize tables’.
And that’s it.
Or do it using a plugin:
If this seems difficult or you cannot find your phpMyAdmin file then you can use a plugin. Go to Dashboard->Plugins->Add New then enter “Optimize DB” into the search box. You will find a good selection. A good option is obtainable for download from http://www.wpmaniax.com/wp-db-booster/
Simply follow the instructions and you will find it easy to clean up your databases which will make a difference to the speed of your blog.
#16. Use the Newest Version of WordPress
This is fundamental and should not even have to be mentioned. You must make sure you are using the latest version of WordPress if you want the maximum speeds for your site. However, there is a negative side to this, and that it is that:
- Your software might not be suitable for the latest WordPress version. This is particularly the case if the software was not designed specifically for use with WordPress.
- Your plugins might not work as they should with the new version
- Make sure your theme is coded or updated to work with the new WP version.
Most times, WordPress takes these factors into consideration and updates the approved themes and plugins to meet the needs of the new version. However, most themes, plugins and other software applications are developed outside of the WordPress team and may not conform to the needs of the new coding. So check and make sure.
#17. Revisions or No Revisions?
Some people like to keep revisions of their pages on their blog:
If you have revised a post or blog many times you will have a revision stored in the database unless you wish it not to be. Every time you write a post, WordPress autosaves it and it is stored as a revision once saved. This is loaded each time your blog is loaded – and that takes time. Revisions can be used to replace the current content, but are rarely needed.
If you have no need of revisions, you can prevent them being saved by going to the File Manager in your hosting control panel and opening the wp-config file. Use a text editor to add the following code:
define('AUTOSAVE_INTERVAL', 500 ); // seconds define('WP_POST_REVISIONS', false );
Save the wp-config file and revisions will no longer be stored.
#18. Browser Caching
The browser will only request the files if they have been changed. Your server can respond faster to 304 queries (meaning has the file changed?) than to direct requests for them, and so will load the blog faster.
#19. Using External Services
You can offload your feeds to an external service to speed up their supply. Google Feedburner is a good feed tracking service that will automatically do this for you. Feedburner will look after all your feed traffic and will update it every few minutes which is really all you need. You can save a lot of traffic time doing this if you use feeds on your blog.
Considering external services, you could also have your images handled by a third party such as Flickr. It’s worth a try because it is free. Likewise, if your own server is limited in space, then you could speed up your site by offloading some of your static files (images, etc) to another server such as the Open Source Lighttpd. Just a thought, but worth pursuing, though you may not be able to control copyright with some of these third-party image sites.
#20. Check your Blog’s Speed
It is important to carry out regular tests on the speed of your blog. This can vary according to the location where it is being tested. The farther a server is the testing tool then the slower the speed will appear to be.
Try these tools, and choose the one you like best. You can then measure the effect of your speed-up actions by using the same tool for each test.
YSlow requires your contact details before carrying out the test. It is interesting to compare the results of each test. Google Insights is excellent and offers suggestions on how to reduce the loading speed of your blog based on each element involved.
You can also add the following code into your footer. This gives you an indication of how slow or fast your site is from day to day.
<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.
So there you have 20 ways how to speed up WordPress site – no more excuses for slow loading and complaints from your readers. In fact, if you fail to apply most of these you may find your readers do not bother to make complaints – they just go elsewhere! So get proactive – and contact us if you have any questions on how to speed up a blog.