WordPress Speed Optimization Guide – Part 2

Speed Optimization - Part 2

WordPress Speed Optimization Guide – Part 2

In the first part of our WordPress Speed Optimization Guide, I have already explained the entire procedure to take the site backup before beginning the speed optimization of any WP site. I have covered separate sections about conventional WP backup system as well as WP Engine backup. Controlling comment spam, Updating WordPress core installation, WP Plugins and cleaning junk files are some of the other topic covered in WP site speed optimization guide Part 1. It is highly recommended to go through Part 1 of this guide before moving any further to get a better understanding about the entire WP site speed optimization procedure.

Continuing our series of WP speed optimization tutorial, let us move ahead with the next steps towards speeding up WordPress sites.

6Tweak wp-config.php file to Improve Site Load Speed

A very important file in WP install is wp-config.php. The file is also quite instrumental behind configuring WordPress install to achieve better performance. Before making any changes to wp-config.php, download a copy of the file to your local PC so that the file can be uploaded back to restore the site in case of anything going wrong breaking your site down. Edit wp-config.php by adding the following code at the bottom of the file.

define('WP_POST_REVISIONS', 12);
define('WP_DEBUG', false);
define('WP_MEMORY_LIMIT', '98M');
define('WP_MAX_MEMORY_LIMIT', '128M');
/* That's all, stop editing! Happy blogging. */

7Tweak .htaccess file to Improve Site Load Speed

Quite similar to wp-config.php, another important file in WP install is .htaccess file. Configuring .htaccess file in the right way holds the promise to load WP sites faster. Before editing .htaccess file, download a copy of the file to your local PC. It will help you restore the site in case of any abnormal behaviour observed after editing the original file. Edit .htaccess file by adding the following lines of code at the beginning of the file.

<ifModule mod_php5.c>
php_value zlib.output_compression on
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/plain text/html application/x-httpd-php-source
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE font/truetype application/x-font-ttf font/opentype application/x-font-otf
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"

8WP Site Speed Optimization with Site Speed Analytic

Site speed analytic offers some effective site speed optimization tools to understand the site speed behavior. Looking at various site speed analytic reports, you can diagnose the site speed issues hitting your site. Once the site speed problems are successfully diagnosed, you can improve site load speed by resolving all the diagnosed site speed problems one by one. For baseline WP site speed analytic reports, I prefer some online site speed testing tools.

  1. GTmetrix (PageSpeed Grade and YSlow Grade)

  2. Pingdom Tools

  3. Webpagetest

In order to get the best site speed analytic reports, try to use the location for all the tests as Dulles, Virginia in United States of America.

Page load time is directly proportional to the page size. Larger is the page size, higher is the page load time and slower is the site load speed. My rule of thumb is to have a maximum page load time of 1 second for a page size 1 MB. For example, If the page size is 2 MB then the page should load in not more than 2 seconds. As an example, I have considered my own website as a study object to explain the entire WordPress speed optimization process.

Let us have a look at the Pingdom Tools site speed test report of my own website.

WP Speed Optimization Guide Part 2Tested from Dallas, Texas, USA on August 1 at 13:01:20

Page size: 424.4 kB

Load time: 437 ms

Requests: 50

Perf. Grade: 100/100

Your website is faster than 98% of all tested websites

Now, look at the Performance Grade TAB on the speed test report to see that I have already fixed almost all the page speed factors because of which speed test results are awesome.Pingdom Tools Analysis WP Speed Optimization

While checking your site speed on Pingdom tools, you may find these factors showing values below 100%. All the page speed factors scaled below 100% should be fixed to improve your WP site speed.

You should check your own WordPress site to analyse the various speed factors which are in need of improvement. Now, I am going to explain some of the most important areas related to speed issues as faced by majority of WordPress sites. Moreover, in this speed optimization guide, I am also going to help you get rid of all such speed related blockages pulling your site down on speed meters.

8.1How to Fix Remove Query Strings from Static Resources ?

One of the major speed pulling factor is the presence of query strings on static resources. Most of the caching systems will not cache any resource containing a “?” in the URL, even if a Cache-control: public header is present in the response. It means that the URLs must be free from “?” to allow caching systems cache all such resources.

Remove Query Strings from Static Resources is an easy to use simple WordPress plugin that does the job of removing query strings from static resources quite efficiently. You can even download the plugin directly from atulhost.com. Install the plugin, activate it and you are done with this site speed factor.

8.2How to Fix Minify Resources for Improving Site Load Speed ?

A very simple and easy to use WordPress plugin WP Minify Fix does the job of compressing as well as minimising JavaScript and CSS files in WordPress pages/posts. This WP plugin integrates the Minify Engine into WordPress CMS. It not only combines multiple JavaScript files or CSS files, rather it also removes unnecessary comments and whitespace.

After minifying the resources, it also uses optimal client-side cache headers and gzip encoding to reduce the load on server, thus improving page load time. The WP plugin is easy to install. It can also be easily activated on your WordPress install.

  1. From WP Dashboard, Add New Plugin WP Minify Fix.

  2. Activate the plugin.

After activating Remove query strings from static resources and WP Minify WP plugins, scale your site speed on Pingdom Tools to observe the difference. A comparative analysis of your site speed test results before the activation and after the activation of these WordPress plugins will help you analyse the site speed performance achieved so far.

Now, let us have a look at GTmetrix site speed test report to fix some other site speed factors for increasing site load speed.

GTmetrix site speed report analysisPage Speed Grade: (94%) A

YSlow Grade: (92%) A

Page load time: 0.90 s

Total page size: 401 KB

Total number of requests: 45


Study the test report, understand, analyse and try to observe the effect of different site speed factors (listed as Recommendations under Breakdown) on page load time. By clicking the various speed factor tabs, you can watch the detailed speed optimization analysis to proceed further, along with reading the recommendations for fixing these site speed issues.

You can even minify your JavaScript and CSS resources manually without installing the plugins. The process is quite straightforward and simple. Open GTmetrix Tool and analyse your website to get a detailed speed test report. Clicking on the Minify CSS as well as Minify JavaScript tabs, you will get a list of non-minified resources along with a link to download their respective minified versions.

Download the files and replace the original files on your WP install with these downloaded files, but do not forget to backup your files before substituting. If you notice any abnormal behavior after replacing the files, restore the original file back.

An ideal situation would be to push all the site speed factors to 100%, but because of many external dependencies, it would not not be practically feasible. Although, we can improve most of the site speed factors to a score of 100 or quite close to 100. Let us fix these speed hindrance factors one by one.

8.3How to Serve Scaled Images for Improving Site Load Time ?

Serving scaled images means uploading the same image size as framed to display in the web page. As an example, if you have uploaded an image of size 400px × 400px against an image displayed on the web in size of 200px × 200px then you are not serving scaled images. In such a case, WordPress has to resize the image from its uploaded size to the served size, thus adding to the page load overhead.

It is highly recommended to upload the same image size as it is served to display on the web page. Scale your images to the exact served size before uploading it. Once, you scale all the images to the correct size, the GTmetrix speed test report will shown a score of 100 against Serve Scaled Images. Use a photo editor as per your convenience to scale images.

8.4How to Optimize Images to Reduce Page Load Time ?

Click on the Optimize Images Bar to see the status of unoptimized images on your site after making the site speed test. You will see a list of images along with its full path. Moreover, you will also see a link to an optimized version of the image next to the original image link. GTmetrix has already optimized the non-optimized images and has placed a link.

It will also show some statistics about the compression and the file size savings after optimization. An easy way to optimize your site images would be to download these optimized images to your local PC, rename the files and replace it with the non-optimized files existing in your WP install. You can use cPanel or any FTP client to upload files from your local PC to WP install.

As an alternative, you can also use some image optimization tools to optimize images with an objective to reduce page load time.

  1. Yahoo!Smush.it
  2. Compress Now
  3. Prizm Cloud

You can use employ any of the above online image optimization tools to optimize images before uploading it to your WP install.

8.5Minimize Calls to Other Sites from Home Page to Improve Site Speed

Keep your home page free from external site links or at least minimize it to reduce page load time. Lesser is the number of calls to other sites from your home page, better is the site load time. In order to understand this concept, let us have a look at the following webpagetest speed test report.

Webpagetest site speed analysisFirst Byte Time : A
Keep-alive Enabled : A
Compress Transfer : A
Compress Images : A
Progressive JPEGs : A
Cache static content : B
Effective use of CDN : YES

First View – 1.560 s
Repeat View – 0.942 s

First View is one of the most important speed analytic factors as this is the site load time for a first time user. Ideally, it should be below 3 seconds.

Repeat View is the page load time for a repeat load by a user who comes back to your site. If the site has deployed the right caching methods, the value of repeat view will always be less than the First View.

The above WP site speed analytic report is not disclosing much about the overhead because of loading external site’s objects, but if you look at the domains tab of the same speed analytic report, you will find some detailed information about the impact of external links on your site.

site content breakdown by domainAs an analogy, you can compare it with a scenario where you drive to the market for purchasing bread. When you get back home, you realize that you forgot to buy the milk. Now, you drive back all the way to market once again to purchase the milk.

Creating an external link on your home page does the same. Let us say, you have a Twitter widget or Facebook widget on your home page. Now, your web host server has to load the items from Twitter before loading your website. It increases your site’s page load time by adding to page load overhead.

I highly recommend to keep home page neat and clean. Ideally, it must be free from calling external site’s objects or at least minimize it to the best possible extent. Keeping your home page free from calling other sites will speed up site load as server will have to handle less calls for loading your WP site.

Apart from the above mentioned site speed testing tools, you can also use the following online speed analytic tools for some detailed site speed analysis.

  1. Webhosting Hero
  2. Feed the Bot
  3. Load Impact

You can now proceed to WP Speed Optimization Guide – Part 3 for the rest of the steps.

You may also like to have a look at some of the my other related posts such as impact of WP Plugins on site load speed, impact of web host servers on site speed and how bad is CPU Throttling for website load speed.

Post Editor : Ashutosh Kasera


WordPress Site Speed Expert, Speeding up WordPress sites across the Globe

I am the fuel behind the high speed of innumerable fast running wordpress websites hosted either on a cheap server or a dedicated server.
Today, Speed is a matter of great concern, and I don't only optimize but re-energize. I am also a lifetime WPMU Dev member.

One of the largest free blogging websites BlogLines in South Africa is my baby. I not only conceived the idea of free blogging in South Africa, but also implemented it with an objective of adding a new dimension to the world of free blogging. Blogging helps us in enhancing the quality of our social life by transforming the ways in which we share our ideas and opinions with each other. South Africa blogging environment has never been so easy and user-friendly as it is today.

I have practised and learned all the technical aspects related to WordPress. In the past couple of years, I have developed a wide range of websites using WordPress, WordPress MU and now using the latest WordPress MultiSite.

I am the WordPress Speed Energizer Wiz, and I am always hunting around to find slow running websites. I know, these websites need me in order to live a long and healthy life.
Only the wordpress sites powered with speed, capable of running at full throttle are going to survive in this tough and competitive world of Internet.

Need my help but can not afford my hourly rate buy me coffee and i will do a full report on your website.

    Follow Me:
  • facebook
  • flickr
  • googleplus
  • linkedin
  • pinterest
  • twitter
  • youtube

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.