WordPress Speed Optimization Guide – Part 4
This is the fourth and the last part of our multi-series blog post WordPress Speed Optimization Guide. It concludes the entire WP site speed optimization procedure. All the readers who are landing directly to this post are highly recommended to go through the previous posts before moving ahead any further. You should start with WordPress Speed Optimization Guide – Part 1 and then proceed to WordPress Speed Optimization Guide – Part 2 and WordPress Speed Optimization Guide – Part 3 in a sequence. Missing out the sequence would be a bad idea as many speed optimization steps explained in this tutorial are interdependent. You should go through the steps from beginning till the end in a series to tune your WordPress site for speed.
Let us move ahead to the rest of the speed optimization steps in this WP speed tutorial. I have tried to make this tutorial as simple as possible so that the users who have even some basic understanding of WordPress can effectively tune their WP sites for speed.
13Optimize Web Host Server to Build Platform for WP Speed Optimization
Web host server is an indispensable part of any website. Tuning your web host server to improve performance should always be performed at the root level. WP Speed optimization on a weak and/or bad web server may not get you the speed as expected due to server’s limitations.
By following some speed optimization tips and tricks, you can easily scale your web host server to experience a better web hosting environment for your website. Read one of my other posts to understand the impact of web host servers on site speed optimization.
13.1Enable G-zip Compression
Enabling G-zip compression has the potential to speed up almost all the sites considerably. First of all, you should check whether gzip compression is already active on your web server or not. If it is already switched on, you can jump to the next step, although if it is switched off then you must activate it before moving ahead. A couple of options can be deployed on your WP site for enabling G-zip compression.
Checking the status of G-zip compression on your site is quite straight forward. Create a php file on your server by giving it a name such as yourcool.php and add the following lines into it.
Open www.mycoolsite.com/yourcool.php in browser to check the status of G-zip compression. Search for a phrase zlib.output compression on the web page and check whether it is ON. You can move ahead to the next step after confirming that it is switched ON.
In case, if G-zip compression is switched off then edit your site’s .htaccess file. Add the following lines of code at the top of .htaccess file and save it.
php_value zlib.output_compression on
Load www.mycoolsite.com/yourcool.php once again on your browser to confirm the status of zlib.output compression as ON. In case, if you still see the status as OFF, then the permission to configure zlib.output compression might be locked at the web host level. Contact your web host service provider and ask them to switch it ON for you.
You can even try to switch ON zlib.output compression with an alternative method.
- Create a new file on the server either in /root or /public_html and name it php.ini.
- Do not add any code in the newly created file, rather open your site www.mycoolsite.com in a web browser to confirm that everything is working fine on the site.
- If the site opens up without any trouble then you can append the following lines in the file one by one.
memory_limit = 512M
max_execution_time = 240
max_input_time = 120
As you append the above mentioned lines one after the other, do not forget to pull www.mycoolsite.com/yourcool.php to ensure that the values of the defined entities are changing as the changes get finalized.
If everything is done as mentioned then you will see the value of zlib.output_compression as ON, memory_limit as 512M, max_execution_time as 240 and max_input_time as 120.
13.2Enable Keep-Alive for Fast Loading WordPress Sites
First of all, you should check whether Keep-alive is enabled on your website or not. The easiest method would be to perform a speed analytic test at Webpagetest. Look at the value of Keep-Alive-Enabled status. If it is Green with a score of A then you are good to move ahead, else you should ask your web host service provider to get it enabled.
13.3Leverage Browser Caching / Specify a Cache Validator / Specify a Vary: Accept-Encoding Header
Edit your site’s .htaccess file and add the following lines of code at the top of the file.
php_value zlib.output_compression on
Cache Control Settings for one week cache
Header set Cache-Control “max-age=604800, public”
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 font/truetype application/x-font-ttf font/opentype application/x-font-otf
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 application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
It will fix the following site speed issues:
- Leverage Browser Caching
- Specify a Cache Validator
- Specify a Vary: Accept-Encoding Header
13.4Avoid Landing Page Redirects
Redirection to different sites from the landing page adds an overhead delay to the page load time as it takes some time to fetch external website objects to your site. It increases the waiting time for visitors on your site. In most of the cases, redirections can be easily eliminated without changing any of the page functions. Click here to access a good resource to learn more about how to to avoid landing page redirects.
13.5Optimize PHP / zlib.output_compression
You can optimize php/zlib.output_compression by following the procedure mentioned in section 13.1. If you have already executed the procedure then your site’s php and zlib.output_compression must be working well on your WP site.
14Optimize WordPress Database for WordPress Speed Optimization
WordPress Database Optimization can be done in two different ways. The first method is simple and easy which could be performed by almost anyone, while the second method is highly recommended only for advanced users.
14.1WordPress Plugin to Optimize WP Database
The beauty of WordPress lies in the use of its simple plugins. WP Optimize is a great WP plugin to easily optimize WP database with the click of a button. Add the plugin from your site’s WP dashboard, open settings and follow the prompts. It will optimize your WP DB as well as clean all WP Database tables.
14.2WP Database Optimization for Advanced WP Users
This DB optimization method is highly recommended only for advanced WP users. If you are not much aware about DB concepts or PHP MyAdmin then you should only use WP Optimize rather than attempting to execute this DB optimization procedure.
14.2.1 PhpMyAdmin Configuration to WordPress DB Optimization
Login with your credentials to PhpMyAdmin. The screen will display a list of DBs. As soon as you select the correct DB, you will see a long list of files. Look for Check All option at the bottom of the screen and OPTIMIZE TABLE in the drop down list. Select Check All and OPTIMIZE TABLE.
If everything is done as per the description, you will see a Green Bar “Your SQL query has been executed successfully”. The green bar message notifies that the process has been executed successfully. You can take an extra step like me to remove all those tables which are not required.
It is not feasible for me to explain the exact name of the tables that you need to remove, but if you are aware of the installed plugins then you can do it easily. In most of the cases, the tables are given the same names as their respective plugins.
14.2.2 Search and Replace WordPress DB (Step is required only when you have changed site URL)
- Upload a file downloadable from Interconnectit.
- Open the file www.mycoolsite.com/mycoolfile.php in your web browser and follow the prompts on the screen.
It will ask you to find and replace, let us say you were looking for mycoolsite.com and now you want it to be coolsite.com.
Following the entire procedure, you can optimize your WP database for better performance.
15Implement CDN Services on WP Site for Speed Optimization
Content Delivery Network, commonly abbreviated as CDN is a good resource to optimize sites for speed. An easy way out is enabling CloudFlare on your WP site, although if you need a dedicated high performance paid CDN service then MaxCDN is a good choice. You can go through my post on Setting up MaxCDN on WP Engine for detailed instructions about enabling MaxCDN on your WP site hosted on WP Engine.
WP Engine is quite effective in speeding up WordPress sites, although when you enable CDN services over WP Engine, it takes the speed performance to another level. The need of a CDN service for your site can be better judged based on some important factors such as your website traffic and the power provided by your web host service provider. For light weight, simple websites with nominal traffic, WP Engine itself is a good choice, although for heavy sites experiencing high web traffic, power of CDN services would be required.
16Caching Plugin or WP Engine for WP Speed Optimization
In case, if you are hosting your site on WP Engine then you might not need any WP cache plugin. Although, if you are using any other web hosting service then you can use an appropriate WP cache plugin to improve your WP site speed performance. Let me list out some of the most popular WP cache plugins and the way it can help towards WP site speed optimization.
16.1WP Super Cache
WP Super Cache is a powerful cache plugin to help you optimize WP speed performance. It is a simple and straight WP plugin that even works best with out-of-the-box settings. You can even experiment with the plugin by changing its various settings and scale the performance to suit the best to your WP site.
16.2W3 Total Cache
W3 Total Cache is another powerful cache plugin, but needs complex configuration adjustments that suits your WP site. I personally never recommend it as the complexity of its detailed configurations kills the simplicity and the ease of use as expected from WP plugins.
Quick Cache is one of the simplest and easiest cache plugin for WordPress. Add the plugin and simply activate it with out-of-the-box settings to experience a WordPress site optimized for speed. If you love the simplicity of WP Plugins then you are going to love Quick Cache for WP speed optimization.
16.4Wordfence Falcon Engine
Adding Wordfence Security Plugin from your WP Dashboard is as easy as adding any other WP plugin. Falcon Engine was introduced with the release of Wordfence 5. It is one of the best caching options available for WordPress sites and the best part is its simple configuration. Nothing complex, just set and forget it. Once the Falcon Engine option is activated from Wordfence security panel, it takes care of all the caching requirements of WP sites automatically.
Now, we come to the end of our multi-series WordPress Speed Optimization Guide. I hope that by following the entire site speed optimization procedure, you can deliver better site speed performance to generate higher level of satisfaction to your site visitors in terms of site load speed. Moreover, a fast loading website will also help you perform better on SEO scale as Google loves fast loading websites. In case of any queries regarding WP speed optimization, please feel free to comment or reach out directly to me. It would be a pleasure for me to help you speed up your WP sites in an effort to deliver a fast Internet experience to one and all.
Post Editor : Ashutosh Kasera