We all have been there when the site loading speed used to kill most of our time, and it was really frustrating. Even after gaining experience in WordPress Development, are you still facing delays while loading your WordPress site? If yes, then you are about to get a proven solution to your concern.
In order to improve the speed of your WordPress website, the first thing you should do is look into the “Speed Optimization”. Now, for those who aren’t aware, Speed Optimization is the technique that makes your sluggish website pages load faster. The main reason that I am suggesting it because I believe it proves to be one of the most important aspects when you are done developing a website because it saves ample of your time. Slow loading pages may enormously affect the quality of the websites that you provide, and if you are a WordPress Developer, it may also leave your client unhappy with your work because nobody likes to wait. But no need to worry at all, there are numerous ways to do Speed Optimization to your website.
You can improve the speed of your website in many aspects like optimizing images, WordPress database, caching, landing page, minifying your JS and CSS. Also, there are numbers of ready plugins available.
To optimize the images, you can use WP Smush plugin. It reduces the size of all the images without affecting the dimensions. You can save few MBs of your site just by optimizing images.
Also, there’s another plugin EWWW Image Optimizer for the same purpose. You just need to change the settings according to your feasibility.
There’s one option in case you want to speed up your page loading even faster, and if you have numbers of images to display on that page, you can simply useLazyload for the images. Removing the query strings from static resources also affects the speed. And there is a plugin for the same.
Now moving on to the things that can be done with JS and CSS. They can be minified to remove the redundant data such as code comments, unused code, etc. without affecting its working.
These were the most basic ways to improve page speed, to get more result, the compression can be done and for that, you need to optimize .htaccess file. The mod_deflate compression can be used but if it does not work you can use mod_gzip or you can use both, both serve the same purpose.
# BEGIN DEFLATE COMPRESSION
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# END DEFLATE COMPRESSION
# BEGIN GZIP COMPRESSION
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
# END GZIP COMPRESSION
You can also set browser caching, in which some files are kept in the local memory for specified period of time.
#BEGIN EXPIRES HEADERS
# Enable expirations
# Default expiration: 1 hour after request
ExpiresDefault “now plus 1 hour”
# CSS and JS expiration: 1 week after request
ExpiresByType text/css “now plus 1 week”
# Image files expiration: 1 month after request
ExpiresByType image/bmp “now plus 1 month”
ExpiresByType image/gif “now plus 1 month”
ExpiresByType image/jpeg “now plus 1 month”
ExpiresByType image/jp2 “now plus 1 month”
ExpiresByType image/pipeg “now plus 1 month”
ExpiresByType image/png “now plus 1 month”
ExpiresByType image/svg+xml “now plus 1 month”
ExpiresByType image/tiff “now plus 1 month”
ExpiresByType image/vnd.microsoft.icon “now plus 1 month”
ExpiresByType image/x-icon “now plus 1 month”
ExpiresByType image/ico “now plus 1 month”
ExpiresByType image/icon “now plus 1 month”
ExpiresByType text/ico “now plus 1 month”
ExpiresByType application/ico “now plus 1 month”
ExpiresByType font/truetype “access plus 1 month”
ExpiresByType font/opentype “access plus 1 month”
ExpiresByType application/x-font-woff “access plus 1 month”
ExpiresByType image/svg+xml “access plus 1 month”
ExpiresByType application/vnd.ms-fontobject “access plus 1 month”
#END EXPIRES HEADERS
In the above code, the time period is the time which specifies when the data will expire.
# BEGIN Cache-Control Headers
Header set Cache-Control “public”
Header set Cache-Control “public”
Header set Cache-Control “private”
Header set Cache-Control “private, must-revalidate”
# END Cache-Control Headers
When you start implementing the above methods, make sure that you keep checking if every module of your website is working properly after making any single change. If you have any queries or feedback related to the suggestions on this blog, feel free to drop a comment. And if you want to hire WordPress Developer who can fix your website’s loading speed concern, contact our team on email@example.com
Hope this helps!