Worpress is very popular and easy to manage CMS now a days. Thousands of website using wordpress CMS. WordPress also provides excellent inbuilt features , wide range of plugins to build any website. Its always easy to build website using wordpress but it is little difficult to maintain site loading speed when data increase to website.
According to my experience with wordpress , I would love to share some helpful tips :
1.Optimize all images :
Images are very common element in any website. Every website have less or more images. Now there is lot of difference in site loading speed with optimized images and without optimized images. So remember that do not upload any image to your website without optimize it. You can use Adobe photoshop or any other tool to optimize your images. I always use online tool Kraken to optimize all images. This tool is awesome and optimize images without change its actual quality.
2. Compress Css and Js :
I just realized that in my wordpress website style.css actual size was 80 KB and after compress it came with 60 KB. So if only one css could reduce 20 KB size then think about if you compress all css of your site then how light it will be for server to load. So compress all Css and Js of your wordpress site and reduce its size. I use Css Compressor to compress all css files. Your site will work prefect as before if you compress css and js properly.
3. Manage leverage browser caching :
There is always time difference between all website data loads from server and from browser cache. For website it adds round trips to get every element from server and it takes long time. So caching help your website to load data from browser cache rather than server. Caching always reduce website loading time.
You can set caching parameter using .Htaccess file in below way :
## EXPIRES CACHING ##
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 2 month"
ExpiresByType application/pdf "access plus 2 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
## EXPIRES CACHING ##
You can change expiry dates according to your need.
4. Enable Gzip compression :
When user comes to website and hit for specific page at that time website do same request to load data from server and then it loads data to browser according to user request. It takes time as user request goes to website then website call to server and server send data to browser to load. Now if Gzip compression is enable then it sends all data in compress format to browser so it reduce loading time automatically.
If you are using apache server and .Htaccess , then you can Enable gzip compression in below way :
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 BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
But first you need to make sure that Gzip option is enable from your server side. If yes then only above code will apply. You can call to server technical person to make sure Gzip compression is enable OR you can check by calling phpinfo() function in one sample page , it will show you Gzip status.
5. Reduce plugin use :
6. Reduce 3rd party data use :
You can not do anything in predefined code ,style of 3rd party plugin or API. Because they just provide you API to use it , all data comes from their server so you can do compress it , modify it. Most of wordpress sites loading slow because of 3rd party API use.
7. Avoid inline CSS :
Use of inline css it not standard way to do programming. Use always external Css. External css fetching save time for browser. Also it is easy to compress if css is separate. It is easy to maintain and looks clean.
8. Avoid @import css :
Generally we use @import to import another style sheet to existing one. Now when browser call it , it is not able to download both css at same time so browser call one by one css and it adds round trip to server. So overall it increase site loading time. Therefore try to avoid css @import.
9. Select good host :
Your hosting selection is also one important aspect and play an important role for site loading speed. If your hosting/server is weak then there it no effective use of above techniques. You do all things perfect from your side to load your website fast but server is not capable then it will be like meaningless efforts.
10. Maintain and optimize database :
Your database should not have unnecessary tables and data. You should optimize database on some regular basis. It includes tasks like delete spam users , images , comments and a lot more. Also you should delete unnecessary and very old backups of database if you have recent backup. I would recommend Wp-Dbmanager to optimize database in excellent way.
I am sure that above steps will help you to make your wordpress website fast loading.