15 Ways to Optimize Speed of Large WordPress Websites [Updated]

user-1
Neeraj Agarwal

Are you loosing visitor on your website because of a slow loading WordPress site ?

A slow loading site can be frustrating always and ultimately compel the visitors to shut it down and switch to next one.

It has been an issue with the WordPress websites with a huge number of blog posts and all that results in slow loading speed. Although, there are also other WordPress websites which handles the traffic easily and run efficiently while loading.

I am going to tell you useful tips to help you to speed up your website.

Step #1: Use a proper web hosting provider

Every website requires hosting space to run online. How would you decide which hosting is better that speeds up your website ?

  • Server Location is crucial: Choose the server that is near to the location of your user that you are serving.

Let’s say, if you run a local restaurant in US.

Than choosing the server nearest to your customers location is the best thing to do. As servers located close to your customers has minimum latency. A faster website make your users happy and helps you to increase your business.

  • Choose Hosting Server either Linux / Windows: Often it is a hard task for beginners to select a hosting provider. WordPress is built on PHP and it runs well on both Linux and Windows server, you can pick either of them. Both are equally capable to turn your website extremely fast.
  • Speed Test: Once you purchase hosting you can make a speed test to your server using web speed page test. As speed is one of the most important factor for a good hosting.
  • Hard Disk: Use SSD (Solid state drive) for hosting your website as these hard drive give better performance for your website.
  • Server Up-timeChoose hosting that provide maximum uptime for your server. As Google loves website that perform best and up-time for maximum time.
  • Support:  If something goes wrong with your website, there must be technical support team to help you with your server needs.
  • Hosting Space:  Now a day most of the companies are offering unlimited bandwidth and storage. If you see plans on any website, I recommend to take minimum of 10 GB of storage and bandwidth for small websites, so that you can easily update your website in future with more content with no issues. If you run a large website then I recommend you to choose space and bandwidth according to future needs of the traffic that you are expecting on your website.

Recommended Hosting

Liquidweb and DigitalOcean are really good hosting providers.

There are some other hosting providers like Hostgator, BlueHost etc. (But we do not recommend you to choose them, if you are not a tech-savvy person then it might a big problem because they do not have a great tech support.)

Step #2: Use Pingdom Tool: Quickest and easiest one

Before starting optimization, check the current performance of the website by using Pingdom tool so that you should have some benchmarking figures to compare against after you make the changes and see how it has affected the performance.

speed test

 

The Pingdom Tool tells you about the loading speed of your website. With Pingdom, you can identify what areas of a web page are fast, slow or too big, what best practices you are not following. It is too easy to use Pingdom tool.

Pingdom Tool helps you to identify “broken links”, “slow loading of images, JS or CSS”, webpage size, number of requests, parallel loading of files, cache information etc.’

This identification of crucial website data helps you to plug lots of issues with your website. Let’s analyze them one by one …

Broken Links: Broken link slow down the website. As our server continuously hit file to fetch. We recommend you to remove broken links or connect file to proper source so that server loads quickly .

File Size: If File size is big enough to load then you have to reduce the file size.

  • Image Compression: – PNG image format is good to use on website. But if your images are big you can compress your images with online tools like tinypng and tinyjpg that compress png and jpg images.
  • CSS and JS Compress :-  CSS or JS file Compression will help you to reduce file size and make your website to load fast. There are lot of website that minify or compress css.
  • Page Size :- Reducing page size again load your website fast. If possible, work in a way to make your page size small.
  • Cache File :- Cache file on your server again enhance the speed of websites. There are wp total cache plugin available on WordPress to cache entire website file, Database and much more.

There are various other tools also to check your website’s loading speed like Yahoo! Y slow (Work on Chrome Extension to test your website), Google Page Speed.

But I would suggest that the Pingdom tool is the easy and the quickest one. It provides a straight forward approach and gives the entire status of your website within no time.

Step #3:  Use minimum number of WordPress plugins

Using too many plugins in a website can create an overhead to your blog and slow your website speed. So choose your plugins carefully and use only those which are needed for your website.

If you are using too many plugin, there are some plugin available on WordPress which tell which plugin is good or bad in performance part.

P3 (Plugin Performance Profiler) :- It is the best plugin over WordPress plugin directory to check which plugin is creating performance issue on your website. Once you install this plugin and run a test this plugin generate a report that will show you with plugin is slowing your website. You can disable that plugin or install some alternative plugin to fix the speed of your website.

plugin speed

Step #4: Delete Spam comments

Batch Comment Spam Deletion WordPress plugin help you to delete spam comment in batch. One of the most important thing – if you have a popular website, you will get thousand of spam comments everyday. No plugin is enough good to delete large number of spam at once from a website. So if you run this plugin then it will delete spam comment batch wise and run until all the spam comments were deleted.

Alternatively, Spam Comments Cleaner plugin will delete comment on monthly, weekly or daily basis with the help of cron job to schedule activities for an specific event.

spam comment

Manually delete spam comments

You need to be extra careful with manually delete spam comments. Counting takes a lot of time on big databases. Keeping thousands of spam comments in your database slow down your website. Keep deleting spam comments from your database.

You can perform these queries to delete comments from your database.

DELETE FROM wp_comments WHERE comment_approved = ‘trash’
DELETE FROM wp_comments WHERE comment_approved = ‘spam’
DELETE FROM wp_comments WHERE comment_approved = ‘0’
DELETE FROM wp_comments WHERE comment_approved = ‘post-trash’

Although these are five queries but they will quickly remove the comments from the database.

On the other hand if you want to count all the comments from your database then you can write these queries:

SELECT FROM wp_comments WHERE comment_approved = ‘trash’
SELECT FROM wp_comments WHERE comment_approved = ‘spam’
SELECT FROM wp_comments WHERE comment_approved = ‘0’
SELECT FROM wp_comments WHERE comment_approved = ‘post-trash’
SELECT COUNT FROM wp_comments

The last query will count all the comments from the database with in no time.

Step #5: Delete Post revisions

When you click on update button in WordPress while updating post, WordPress store these revisions for each update that you can roll back any time. This can create lot of revision on website that reduce your website speed. Cleaning revision is like cleaning unnecessary data from database to enhance speed of your website.

This is a weakness of WordPress. Copies of old post revisions make your database heavier and slow down the speed of your website.

Be sure to delete old post revisions. Install Better delete revision plugin to remove the old revisions from your posts and pages.

Better Delete Revision

Manually Delete Revision

Back up the wp_posts table and then used a simple MySQL command to remove old post revisions. This decreases the table size from 400 MB to 120 MB.

DELETE FROM ‘wp_posts’ WHERE post_type = ‘revision’ AND post_date NOTLIKE ‘2012-%’

Step #6: Choose your theme wisely

Choose a WordPress Theme that is built by some reputed WordPress theme company, Such that you will get a optimized theme for your website. Furthermore, You can consider InkThemes for selecting your WordPress themes

  • Mobile responsive :- Is your WordPress Theme compatible with Mobile, Ipad and desktop. This is really important factor in terms of Google. Now a days Google is giving much importance to the websites that are responsive. As there are large number of user over internet that are viewing website in the mobile devices. So keep remember to check whether your theme is completely responsive. Google release online tool to check responsive layout.

Mobile Friendly

  • Theme update with new version :- Choose theme that is compatible with WordPress updates. Some companies are fast enough to update theme with new WordPress launch or once they find any bug or security issue in the theme. Choose companies that are responsive and take action with update in themes.
  • Improved speed :- Theme that use minimum CSS and JS Files are fast to load. Check With Pingdom tool where your themes have any broken css of js files. If yes I recommend you to ask theme company to fix that issues.
  • Theme Option Panel :- Check if your theme has theme option panel. As these type of theme are some what easy to setup. Not all the themes are easy that have theme option panel.
  • Easiness :- This is the really important factor to consider while choosing WordPress theme. Easy theme makes your life simple and help you to move fast while setting up a website for business.
  • Built in security enhancement:- There are plugins available over internet that help you to check whether you theme is secure or not. Check your WordPress security with Anti-Malware Security and Brute-Force Firewall and Acunetix WP Security are two plugins that would assist you to check security of your website.
  • Search engine optimization :-  You should better take care of updating the theme time to time. SEO features should also included with your theme. To strengthen your SEO it is important to add a custom title to your article/blog. Theme must have main title as in h1 tag.
  • Theme Support :- Does your theme company provide technical support. InkTheme has great support forum. Thousand of users are getting benefited.
  • Beautiful designs :- Does you theme looks good? Theme with elegant design attracts visitors to stay for a longer duration.

Recommended Themes

If you are blogger, I personally recommend BlogSpring, If you going to create business website then Colorway will be best option and if you are going to create business or corporate website that capture leads then BlackRider theme is excellent. These themes are speed optimized and you will get good results for sure.

Step #7: Optimizing the Database

The database is the place where everything about your WordPress is stored. WordPress uses database to store posts, pages, comments, settings and plugin information.

Every time a page is reloaded it reads your database. If the database is bloated, the information can take longer to be found and displayed.

This is the main reason why you need to optimize your database regularly especially if you have a large website.

You can use WP-DB manager plugin. This plugin will help you to back up, restore, repair and optimize your database.

backup wordpress

Step #8: Optimize widgets and images for web to load fast

Unnecessary images and videos on the page affect the loading speed of the page. It is better to keep your page size less than 100 KB.

By using the proper format you will reduce the size of your images. And when they are surfed by visitor’s browser, this operation will be much faster.

WP Smush.it plugin can be used to reduce the file sizes. This will increase your website loading speed.

Good thing about this plugin is that, it allows you to optimize previously uploaded images in posts and pages as well. So you don’t have to download the image and optimize it to upload again on server. It compress images to some extent to maintain the quality of images.

This plugin also have facility to start and stop the optimization of image. Large website have thousands of images on server, So it’s hard to optimize all image at once so you can start optimization process when your server has low traffic and you can stop the process when you think it peak hours.

smush

When it comes to the image optimization, there is another plugin called Lazy Load plugin. If you have lots of images on your web page. This plugin allow text and all other important content to load first, while images at last, so that user don’t have to wait to read content.

Also, Widgets can often put a drain on  page load speed because they rely upon 3rd party servers to load.

Therefore choosing to lazy load widgets can prevent the rest of your page struggling to load. Lazy widget plugin can be used that allows you to select which widgets are lazy loaded.

Step #9: Use a quick caching plugin

Caching is an essential process. It is just like taking a picture of your content and providing it to your visitors without requesting it from the database each time.

Caching converts your dynamically created web pages into a static page. The key thing is to understand is that it makes your pages load more quickly. You can perform after and before speed test to measure the result with caching your entire website.

Every time you load a page, lots of things happen on the back end.

But when we use a caching plugin, this process gets simplified and your content is served from the cache without being generated over and over again. The best plugin you can use to cache your content is W3 Total Cache.

W3 Total Cache plugin will cache your WordPress posts and pages as static files. These static files are then served to users, reducing the processing load on the servers.

Use Gravatars Caching

Gravatar is very popular service determining the identity of any Site admin and show image in the form of thumbnails or icons. Of Course, most of us using Gravatars these days and it becomes more attractive in our commenting system.

The post having the more number of comments is also having the more number of Gravatars. This makes your web page slower while loading gravatars in bulk.

Solution: Again I will recommend you a plugin to enhance your page speed against Gravatars. FV Gravatar cache is a productive plugin that you can use to create cache of gravatar images.

Based on the features of the plugins, user can decide how can they proceed.

optimize your WordPress website speed

Stay for a while and have a look at setting page of this plugin. Here, you can find two options:

Custom cache directory URL:

Here you can define the path where you want to store the caching data. The path you entered is stored in public_html folder of your hosting account. On the other hand, if you leave it blank, your caching data would store in this path – PLUGIN_DIR/images

Gravatar size:

By default, the gravatar size is 96. This is single unit, therefore it signals to a square sized image. It is up to you to alter the size. For example if you insert 80 then plugin cache all the images equals to or smaller than 80 X 80 pixels.

Run cron now:

save your settings and click to RUN CRON NOW to begin the caching process and you’ve done.

Step #10: CDN for WordPress

A content delivery network (CDN) helps to deliver your content, images, CSS and Javascript files from different locations across the globe. Your content is served from the location that is closest to your visitors, so if your visitor is from the US, then your content will come from a server in the US.

A CDN is a collection of web servers distributed across multiple locations to deliver content more efficiently to the users. The server with the fewest network hops or the server with the quickest response time is chosen.

A CDN saves your bandwidth and visitors will experience faster loading speed.

You can use Clodeflare, Google Drive CDN services for WordPress, you can host images and files on CDN.

Step #11: Use gzip compression

Gzip is the most popular and effective compression method and generally reduces the response size by about 70%.

If a user request a page from server. Server first compresses the page content with GZIP technique then sent the page to visitor using http request, once data is completely sent to visitor, the page automatically decompresses. This compressing and decompressing only takes a fraction of a second.

With Compression the page size reduce drastically, page takes less time to transfer and result in faster load time. W3total cache or WP fast cache compress page to GZIP.

Step #12: Optimizing CSS, Java scripts, PHP, etc.

  • Combine CSS files into one big CSS file as one 50KB file loads a lot faster than five 10KB files. More files means more request to server, combining small file in one file reduce request on server.
  • Combine Javascripts into one big file. Combine multiple file into one file.
  • Reduce the number of dynamic HTTP calls (use sub domains to share the load).
  • Use external scripts instead of placing tons of code in your header.php file. This allows the browser to cache the script so it won’t have to read it for every other page.

Best Place To Insert JS & CSS

The web design and styles-element is the first thing that a browser want to render for best possible display. Therefore, it is advised to place CSS at top of the <head> section in your codes.

Javascript is useless until the loading of CSS and also browser takes time to communicate with javascripts. It results the longer loading time of a website. Therefore a JS must place in the bottom section.

This order enables the user to see the page styles first and other media contents and widgets later.

This order also suitable for optimized web page speed.

Step #13: Prevent Image Hotlinking In WordPress Sites

This is a cool concept to know what is Image hotlinking and how does it reduce our page loading speed. But I am boiling down to the question here.

Definition: When you upload images in WP account then a media or image link is created along with it. Other webmasters can use this url or image link to display your images on their websites. This is what we called Image Hotlinking.

The drawback: You may be suck up by the webmasters who use hotlinking with your images and I am 200 percent sure it uses your server bandwidth every time, whenever images are rendered from a hotlinked site. Worst of all, it might cut down your web page loading time.  

Solution: Hotlinking can be prevented only by altering a file present in your server account. This file can be found with the name .htaccess, just go to your server’s cpanel and search for .htaccess file.

In case of hostgator server account you can navigate in a way stated as below:

C-Panel > Files > File manager > select .htaccess (right click and click to edit)

 

Tip: Don’t forget to backup your file here (you can copy paste these codes in a notepad and save it with .htaccess name). In case, if any mishappening is done then we can replace it up with our backup/restored file.

Now copy paste these lines into your htaccess file given below and do remember one thing also: replace the red words with your domain name.

RewriteEngine on 

RewriteCond %{HTTP_REFERER} !^$ 

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?your-site.com [NC] 

RewriteRule \.(jpg|jpeg|png|gif)$http://i.imgur.com/g7ptdBB.png [NC,R,L]

 

Step #14: Turn On Keep Alive Service

Keep Alive is a service is used for creating a persistence connection between the browser and the server side that improves the website performance and speed. A connection without Keep Alive runs discontinuously with several requests.

Actually, Keep Alive is a header and it can also be understood as:

Keep Alive uses the same TCP connection for multiple request (multiple request may be javascripts, css, html files and other multimedia files) at once.
Result: It speeds up website and prevents to breaking a connection occurring at irregular interval.

 

A server without Keep Alive uses the multiple TCP connection between the server and client (browsers) to render the multiple request.
Result: Irregular or discontinuous connection, slow loading speed of website.

Ways to optimize WordPress websites                                                                                                                                                                            

Solution:

The simple solution is turn on Keep Alive and we have to override this header into our existing .htaccess file. So, here’s the code that you will have to insert in htaccess file that overrides your header.

   <IfModule mod_headers.c>
   Header set Connection keep-alive
   </IfModule>

Step #15: Implementing CSS sprites

CSS sprites are the methods to bind multiple images into a single image, by implementing CSS positioning of background. This way, it request a single http request for the multiple images.

CSS sprites are the simple tool used for saving server bandwidth and the speed of the webpage would gradually increase.

Example of CSS sprites:

ways to optimize WordPress website speed

In case 1, let’s have a look at a web page without CSS Sprites, all images has to be established a connection with different connection whereas in case 2, the three images are bind by CSS Sprites collectively and thus, these images are rendered with a single request.   

Solution: We can handle this issue by altering our codes but not every person is genius with programming. Therefore, there are again several plugins out there and here is the one named as CSS Sprites for Google pageSpeed. With a handful number of setting options, your images would be optimized for better website speed.

Hope you like the article. Follow tricks that are mentioned above you find your website is fast enough to load. If you have any query do ask in comments.

Last Updated on: January 7, 2016

Under: ,

Comments and Responses

Your email address will not be published. Required fields are marked *