In this lesson, we will discuss WordPress Optimization. Everyone wants that their website speed should be fast enough so that people will like to visit. Your website traffic largely depends upon your website speed. So we should optimize our website so as to get more traffic. It also affects your search engine rankings. Having a faster website will always give a better experience. So in this lesson, we will discuss how we can optimize our WordPress website.
We will discuss some important tips to optimize WordPress website.
1. Use a CDN
For website speed improvement you can enable CloudFlare on your website. These days website loading speed is one the most important factor in the SEO. If your website is taking too much time in loading then you can lose visitors. CDN has dedicated servers which cloned your site content to the closest location. Whenever a visitor requests your website, the cache of your website will be served to user form the closest server location rather than from the main hosting provider. This will improve your page speed as the content is delivered to the visitor by the nearest location node of the server. The farthest is the visitor, the longer it will take your website to load. So CDN helps to overcome this issue by fetching website from the closest location nodes of the server. You can check how we can setup CDN CloudFlare on the website in our previous article.
2. Use a fast WordPress Theme
WordPress themes provide a better appearance to your website. WordPress provides a number of themes that can be used to look your website more efficient and attractive. But before looking for a WordPress theme we should consider some important terms like the theme is properly optimized and use lesser coding and images because it adds unnecessary weight to your page. The heavier the theme package size, it will take more time to load. Choose a theme which is optimized for desktops, tablets, and mobiles because it leads to higher page rankings. So we should use a light WordPress theme which is optimized properly. To know how to install WordPress theme, read our previous lesson.
3. Optimize Images
Media is an important part of your website. Especially, images provide an additional look at your website. They provide a better way to represent your article and also helps your articles to share on Social Media. It will lead to higher page ranking and also helps users to understand in a better manner. But having more images on the website will lead to increase your pages size which in turn takes a long time to load the website. So we should properly optimize images so that they do not take much space in your database.
Use small images and images should not larger than what is visible on the website. Properly define the size of images and use HTML tags to scale images. If you are using Photoshop for images editing, then save files as Save for Web to optimize images.
You can use a WordPress plugin to optimize images. The name of the plugin is WP Smush.it. It will optimize your images so that they will take lesser space.
4. Use a Cache Plugin
Cache plugins allow you faster your website loading time. It helps you to publish static HTML files instead of dynamic files. So it increases page speed as there are no PHP or MySQL command to execute. It is the most effective way of speeding up your website.
It also serves other functions like minification, Gzipping and much more. You can choose from a number of cache plugins as per your need. Some popular plugins are WP Super Cache, W3 Total Cache and WP Fastest Cache and the most important thing are, all these plugins are free.
5. Enable browser caching
You can enable browser caching so that you can easily speed up the loading time of your favorite website by storing a cached copy of the website. So whenever you visit the same website, it will be served by the cache which in turn increase the browsing speed. It will reduce calls to the server and you don’t have to wait for a long time to browse a website.
You can easily enable browser caching by adding these line to your .htaccess file located in your WordPress folder.
## EXPIRES CACHING ##
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"
## EXPIRES CACHING ##
7. Empty Your Trash
WordPress has built-in Trash system. You can recover pages, posts, and others if deleted accidentally. It is a great way to avoid failure happens accidentally. But having content in the trash will take unnecessary space of your database. The bigger is the database, the longer it will take time to retrieve information from it.
So it is a good practice to have your trash box clean so that it will never take extra storage of your database. You should delete trash items if you know that the content will no longer useful. WordPress will automatically delete trash items after thirty days. You can disable trash system by adding following code in the wp-config.php file located in your WordPress folder:
define ('EMPTY_TRASH_DAYS', 0);
8. Monitor Your Plugins
Plugins are the main reason for site being slow. There are many reasons behind that like bad coding, unnecessary calls to external servers and many others. So we should keep in mind that, only required plugins should be used. No extra plugins should be installed because they make your website slow. We should also update the plugins timely because it fixes bugs which are available in the previous version.
There are many plugins which show how much plugins adding load to the website. You can use P3 Profiler which is developed by GoDaddy to know exactly the right detail about each plugin loading time. So that you can remove the plugin if unnecessary.