Speed up WordPress Website: Tips to Reduce Load Time

WebTechRiser.com > WordPress > Speed up WordPress Website: Tips to Reduce Load Time

For those who are blogging or have a site of their own, WordPress is nothing new. By creating a site with WordPress, the number of people who are doing affiliation is not less. So, what is WordPress, I will not go into that role anymore.

There will be a detailed discussion today on how to try to load your WordPress site faster. For those who are always worried about SEO, site speed is very important. Depending on the speed of the site, the buyer or reader will stay on your site or leave.

Even big companies like Google and Amazon will see the loss of their web service slows down for even 3-5 seconds. Amazon will probably be the biggest loser of the slow loading of its website. Many of his sales will suffer if the site is slow.

Site speed is one of the big factors in Google’s search ranking. Therefore, the speed optimization requirements of your WordPress site are many.

Before We start

I’ve tried to write this article very simply so that you can optimize your site only if you know the basics of WordPress. But, for those who don’t know exactly what WordPress is, and how its backend works – they should check these things out first. Another thing, you need to know how to create a child theme for your theme, or, if there is a child theme – use a theme like this.

Because, many times we will put in new codes or modify existing codes, which may vanish if you update the original theme. Hopefully, most paid themes have child themes, and it also has a separate panel for theme options. Then, you don’t have to make any further modifications to the theme. Whatever you want to edit or add, you can do it from the WordPress admin panel.

So, let’s see, before we work on a site, let’s look at some of the tools that speed up the site.

  1. Google Page Speed
  2. PingDom Tools
  3. GTMetrix

One of my sites at Google Page Speed

Google Page Insight
Google Page Insight

These three web tools will give you ideas for free, which elements are causing your site’s page speed to decrease, and where optimization needs to be done.

Some things to keep in mind before building a site:

01. Find a good web hosting

Good web hosting can reduce the loading speed of your site in the beginning. If your web hosting is not of good quality, you will most likely suffer from site downs and slow loading.

I have never been biased toward having your productive site on free hosting. The truth is, there is nothing free in this world. Different types of free hosting can cheat you. The most important of these is to make your website disappear at any time. If you take free hosting to practice, it is okay, but for business, you should keep yourself 100 yards away from free hosting.

The things you need to keep in mind before looking for good quality web hosting:

01. Server response time (speed, data transfer rate)
02. Technology Used: What kind of technology is this company using (backup system, storage capacity, load balancing)
03. Support – The biggest weapon of any service is its support system. If support is not good, then no hosting company can survive in the market.

Recommendation: SiteGround hosting for WordPress site is the best in my opinion. I myself used to host site grounds and in a word, their shared hosting is better than many dedicated hosting.

Here is a list of the few hosting that WordPress itself recommends.

02. Use good and optimized themes

There are many people who spend a lot of money to create a site, and write content but do not want to spend money on buying good themes for the site. That’s where you make the biggest mistake. A well-coded paid theme that is good for SEO and optimizes speed will naturally increase the speed of your site.

Not only will your site’s theme be beautiful to look at, but you should also choose a theme that is light, loading time low, and fits your content.

I usually use a paid theme that matches the nature of the website. Get the theme from any reputed theme provider. Usually, these themes provide a control panel and theme coding is pretty good. As a result, the loading speed of the site is very good.

Lazy Load, Font, and CSS can be edited from the theme’s control panel in a way that reduces users’ coding hassle.

There are many more cool and famous themes in the market that can be easily modified to suit your needs if needed. Example: Thesis, Genesis, Thrive, etc.

03. Keeping a theme, plugin, and WordPress version updated

Keeping the WordPress version updated, as important as your site speed is, keeping in mind the security, it’s important to update as soon as the update arrives.

When there is a complete version change, just wait a few minutes to update the WordPress version.

For example, many WordPress users have been waiting a long time for WordPress to come up with version 5. They were actually taking some time to understand that their website-based business did not suffer due to the updates.

Many themes and plugins may not work after the update. Active themes and plugin developers, however, start updating their themes and plugins as soon as possible.

Keep in mind, if your theme and plugins are not updated, the chances of your site being slow and hacked are also increased for various reasons.

Recommendation:
Be sure to backup your sites before each update.

04. Use PHP version 7.2 or above

PHP (Hypertext Preprocessor) is a server-side scripting language. Basically, WordPress is built on this language. It is provided on every server when you purchase the hosting.

What’s more, WordPress is a ready-made apartment that you can build (install) on any server space. PHP is the spice of making this apartment. The more the spice is upgraded, the better your WordPress will be.

WordPress itself now recommends using a version of PHP 7.2 or higher.

But sadly, many of us are now using PHP 5.6 version which was introduced in 2014, which is causing harm to your site.

If your current host does not have the PHP version upgraded, ask them to upgrade. If not, change the hosting company.

Recommendation: If you are using cPanel, you will find the option to change the version by logging into cPanel and entering “PHP” in the search box.

05. Use SSL

Use SSL
Using SSL is now a Google Ranking factor

Although SSL is not a factor directly related to site speed, my advice is to start using SSL on any of your sites first. Using SSL is now a Google Ranking factor. It has a deep impact on SEO.

Why use SSL? Let’s find out a few reasons.

Also read:  How to Remove the Menu Container div in WordPress

Google is starting to show some sites on Google search results. Those working with SEO know that SSL is not yet a ranking factor, but any day Google can say that the site will lose its ranking without SSL. What can be done then? So it is better to be careful beforehand.

Consumer trust is another big issue. Google shows messages that don’t have SSL, “This site is not secure / You connection is not encrypted”, etc. Messages may vary from browser to browser.

If you run an e-commerce site, SSL is a must. Your customers’ details, ordering products, making payments online, etc. are not secure if they do not have SSL. This involves improving your business.

It is only natural to think that if we do not see the padlock icon in green on any domestic or foreign e-commerce site, we doubt their professionalism and do not order products from them.

Whatever the reason may be, SSL is now an essential part of your site.

Recommendation: Many good hosting providers have made SSL free.

You can get SSL for free from Let’s Encrypt.

There is also a WordPress plugin for “Let’s Encrypt”. So you can easily issue SSL from the WordPress dashboard. You can find out more about this on the “Let’s Encrypt” website.

06. Warnings for using plugins

The biggest problem with WordPress’s performance is when you use additional plugins. Using plugins is essential for WordPress, but there are some plugins that you can avoid if you want.

For example, the Ajax-based plugins that are used for social media sharing. If your theme has social media sharing options, it is best to use the theme without using third-party plugins.

Many times, many people use different plugins for a single purpose. To view statistics, post-auto-share, and comment boxes, to prevent spam, rather than using a different one-to-one plugin, use a plugin like “Jetpack” to do many things in one plugin.

So, you don’t have to use separate plugins, rather, you can easily update one plugin to do more stuff.

Using a paid theme doesn’t have to use many plugins. The Theme providers usually include custom CSS, Lazy-load for image optimization, and much more in the panel for uploading fonts. As a result, as you can reduce the use of plugins, the hassle of custom coding is greatly reduced.

For those who use a plugin like Visual Composer, the plugin should always be updated, otherwise, you can get in trouble immediately after the WordPress update.

07. Usage of caching plugins

WordPress caching plugins work well for us. A detailed discussion on caching is needed. But, knowing the least, for now, is good that, caching means that your pages and posts are saved in the server as static content and that the visitor is actually shown the page from there.

Generally, when a visitor comes to your site and clicks on a link, the text, image, style, etc. required for that page is then queried from a database and then the page is created and shown in the visitor’s browser. Now if the page is already created (cached), then this query is not needed or is low in volume.

W3 Total Cache, Rocket Loader, etc. are names of good caching plugins. However, you have to be careful about its use. Configuring a plugin like W3 Total Cache is a little time-consuming and if you’re not an expert, you can’t use it with options.

08. Optimize post’s images and media files

Many WordPress users have uploaded large-sized images in their posts. Dimensions of the image may require 800 by 600 pixels, but the image has been uploaded as a 3450 by 2200 pixel image. See, what is wrong with your images?

Using pictures in posts certainly enhances the beauty and acceptance of the post. But, be careful, about what size picture you are using, and how many pictures are placed in a post.

Keeping some things in mind, however, can greatly relieve your site’s loading problem. For example, instead of using .png format images, .jpg or .jpeg format will reduce the size of images.

.webp format, invented by Google, images format images are widely being used. This is because the pixel compression of this type of image is very good and the file size is smaller than those of .png and .jpg images.

Remember, the size of any post gets bigger, just because of the use of graphics in it. Maybe it’s an image or video, or a GIF format picture.

If you publish an InfoGraphic type of post, it will be even bigger. That’s why optimizing images is such a big factor for SEO.

Recommendation: I use both https://compresspng.com/ or https://compressjpeg.com/ to make any image smaller. They do not have official WordPress plugins, but they do provide APIs. You can use WordPress directly if you want.

Looking in the WordPress repository, you will find several good image compression plugins. The point is to adjust the size and dimension to minimize the image quality as much as possible.

Smush is a very popular image optimization and sizing plugin for WordPress.

09. Using CloudFlare can increase the speed of your site

CloudFlare is a free Content Delivery and Reverse Proxy Caching System. Even if you don’t know the meaning of these technical terms, no problem. Most good hosting providers arrange their site with CloudFlare on their cPanel. Turn it on as you need it.

If cPanel does not have CloudFlare yet, register your free account at cloudflare.com and add your domain here. Then they will give you instructions on how to go to your domain control panel and set up CloudFlare’s name server. “That’s it!” From now on, you can use its benefits.

There are more CDN services like CloudFlare but most are not free. There is a need for a detailed explanation of Cloudflare, but we cannot go deep enough to facilitate our discussion. But hopefully, the YouTube video below will help you.

Cloudflare essentially caches the content of your site and shows it to the user. As a result, having CloudFlare as middle-ware does not allow content to be delivered directly from your server, and the content of your site loads faster because of their proxy server fast.

MAXCDN is another such content delivery network, but it does not offer free services.

Another interesting thing is that even those who use the JetPack from Automatic have such a caching advantage for the image. Keeping the image caching on your site loads the image from the WordPress server.

The use of CloudFlare enhances your site’s speed and image-loading capabilities but also helps prevent the site from attacking like Brute Force.

However, like all free things, its use has its limitations. If you can get their paid package, that would be best.

10. Use of Lazy Load

Marketplace theme providers usually include Lazy Load for Image in the Theme Options panel. Now almost all theme developers try to give this option to their theme.

Also read:  Show Content based on Public IP Filtering

Suppose one of the pages on your site has 5 images. Now if you enter the page, all the images are loaded at once, then the speed will be reduced on the page. On the Lazy Load system, only when the visitor scrolls the page and the image comes to the viewport from the bottom of the screen, the image will load. The image below the page will not be preloaded. As a result, the webpage containing many images will not reduce the loading speed due to the images.

Those who browse Facebook on mobile will see that as you scroll down, the image slowly loads. If you have to load them all together, the page load will increase significantly. The same type of system is also being used here.

Those who are not using a theme that includes the Lazy Load option in their theme may opt to use these two plugins.

Currently, Lazy load has been added to Smush, a popular WordPress plugin used for image optimization. Smush’s Lazy Load works excellently. There are 3 different options for a pre-loader of an image. Save your option of choice as a pre-loader and press the Save Settings button. Now go to your site to see how the images are being loaded one by one with the effect of Lazy Loader.

And if you are a JavaScript Guru, you can create your own Lazy Load system, or modify it yourself. Visit GitHub at https://github.com/ressio/lazy-load-xt

Lazy Load will help optimize the loading of your site’s useless scripts, not just images. All you need is to turn on or off the options as needed.

11. Limit Post Revision

Post-revision is nothing new to us. As all WordPress users know, every time you edit or update a post, a revision file will be saved to the database. This is the default WordPress option.

If you change a comma or full stop, it will be listed in the database. The advantage of this is that if you make a mistake you can retrieve the content from the revised copy again.

The problem is, due to the unnecessary data accumulated in the database, it takes longer to query and the site becomes slower. Using plugins like “Wp-Optimize“, you can easily clean up this mess.

However, best of all, delete your post-revision number. For this, place the following code in your wp-config.php file.

define ('WP_POST_REVISIONS', 3);

With this code, we have reduced the post-revision volume to 3. From now on, no post will be saved in more than 3 revisions in the database.

Remember, the code needs to be set before this line:

require_once (ABSPATH. 'wp-settings.php');

After opening wp-config.php in your code editor, copy and search this line and you will find the line.

And if you want to close the post revision at once, replace the above with the following line of code:

define ('WP_POST_REVISIONS', false);

This code will not delete the revisions of your previous posts but will work for the new posts. Therefore, use one of the cleaner or optimization plugins to delete the previous post revision.

Recommendation: Whatever you do, make sure to back up the database and file first.

12. Use of AMP (Accelerated Mobile Pages)

The idea of AMP is not too old. Soon after the emergence of mobile devices, many developers had to think about how to solve the problem of slow page loading on these devices.

Google announced the project in conjunction with many other publishers in 2015. Then, they see that the content pages that follow the AMP standard design load 75% faster than normal pages and consume less than 10 percent of the bandwidth.

AMP has now become an SEO factor for Google.

Let’s see how you can use this amp on your site.

If you are using CloudFlare, this can be very straightforward. Go to the Speed settings of your CloudFlare account. There you will see “Enable Accelerated Mobile Links”.

From there, you can turn it on.

If you haven’t used CloudFlare, you can use WordPress’s own AMP plugin.

After installing the plugin, go to the “Appearance > AMP” section of the WordPress dashboard and adjust your AMP page settings.

To check if AMP pages are working properly, visit your Google Search Console (previously known as, Google Webmaster Tools). Select the property of the site where you are installing the AMP. Find the Accelerated Mobile Pages option in the menu option on the left.

For details on AMP, you can read the official website of AMP.

13. Reduce the number of web spiders and bot crawling

If you are using your cPanel stat or anything else to collect the usage statistics of your website, you can see how many bots are visiting your site and how many megabytes are downloaded per month from the server.

Not all “bots” are good and come to index the site. There are various bots/spiders on the web, such as spambots, email scrappers, Google bots, advertising bots, etc.

Many times, hackers also send different bots to the site in order to make it clear.

In a nutshell, this bot wastes a lot of site bandwidth. Many times they become more than the “actual visitor” of the site.

Google bots eat a lot of resources from your server, so, you can control the amount of crawling you want. Go to Site Settings in your Webmaster Tools, where you can control the crawl rate. You will find this option on Google and Bing Webmaster Tools.

For those who want to better control bot activity, .htaccess is the best solution.

And, if you want to use a plugin, you have to use a plugin like “Wordfence“.

14. Hide the WordPress version

Not only for site optimization but also for security protection, many are willing to hide the WordPress version. According to the default WordPress system, this version number appears in the header of each page:

Removing this one line will reduce some bytes of data. Not to mention, when your site serves thousands of visitors, these few bytes will also help a lot.

However, the most urgent requirement is that no one can know the version of your WordPress site and may not be able to attack your site using the security vulnerability of that version.

Attach the following code to the functions.php file in your theme. I’ve already mentioned child themes, so you can put all these codes in there. As a result, any changes made to your functions.php file will be retained even if you update the main theme.

// remove version from head
remove_action('wp_head', 'wp_generator');
// remove version from rss
add_filter('the_generator', '__return_empty_string');

// remove version from scripts and styles
function yourtheme_remove_version_scripts_styles ($src) {
  if (strpos($src, 'ver=')) {
    $src = remove_query_arg('ver', $src);
  }
  return $src;
}
add_filter('style_loader_src','yourtheme_remove_version_scripts_styles', 9999);

15. Disable XML-RPC, RSD Links, jQuery Migrate

We will now add some code to the functions.php file of our child theme. If you are not an expert, it is best not to use such code. For many, this may not be necessary.

Also read:  How to Change Username in WordPress

Let’s first turn off XML-RPC.

XML-RPC is a protocol that you can use to connect to your WordPress site with an app other than WordPress. For example, WordPress has its own Android app for mobile. If you haven’t used this app, you can disable it by reducing loading time.

add_filter( 'xmlrpc_enabled', '__return_false' );

If the XML-RPC and pingback services are turned off, then we can remove the RSD Link tag from the header. It will require the following code.

remove_action( 'wp_head', 'rsd_link' );

Disable Pingback

Disable pingback from Discussion setting
Disable Pingback

Then, another thing is the Pingback service. If Pingback is turned on, someone links to your site, or, if you link someone, the auto-notification goes to the person being linked. At times it is annoying, but in fact, it increases the loading time of your site.

Log in to the Dashboard and turn off these Pingback services from the “Settings > Discussion menu“.

Security hack: Although we have blocked xmlrpc.php, this file can still be accessed. To turn it off, simply enclose the following code in your .htaccess.

<Files xmlrpc.php>
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order allow,deny
    Deny from all
  </IfModule>
</Files>

Remove jQuery Migrate

“jQuery Migrate” is a JavaScript file (jquery-migrate.js and jquery-migrate.min.js). They are being loaded on every page of your site. Old themes may also be loaded using the previous version of JavaScript, so they are kept, meaning they are dependency files. They are loaded every time you use an updated theme.

If the site has ten thousand visitors per day, these files are unnecessarily loaded ten thousand times. With this plugin, Remove jQuery Migrate, you can easily stop the jQuery Migrate script from loading on your website.

Remove jQuery Migrate Manually

To remove jQuery Migrate manually from your front end, put the following piece of code in the file wp-config.php, save it, and upload it to your server.

// Remove jQuery migrate
function remove_jquery_migrate( $scripts )
{
     if (!is_admin() && isset($scripts->registered['jquery'])) {
         $script = $scripts->registered['jquery'];
         if ($script->deps) {
             // Check whether the script has any dependencies
             $script->deps = array_diff($script->deps, array(
             'jquery-migrate'
             ));
         }
     }
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate' );

16. Disable Google Map

For sites that do not need Google Maps at all, they can do this. Google Maps uses many resources during loading and also increases loading time.

As seen, many themes and plugins are already bundling Google Maps API. If you think a map on your site is not embedded, or not, it is better to disable it.

In the same way, add the following line to the theme’s functions.php file:

add_filter( 'themename_load_google_map_api', '__return_false' );

17. Turn off WordPress heartbeat

The WordPress Heartbeat API is a hot topic for many. Many of my clients have suffered a lot. Sometimes the site may go offline because of this. This is because, on all shared servers, there is a limitation on resource usage.

WordPress maintains the server’s connection to the browser using its Heartbeat API. You see, when you edit a post, it is automatically saved every 15 seconds.

Although this function is useful for many purposes, if you open many edit pages at once, or edit long posts with many images, this heartbeat API increases the server load. As a result, your site may be down.

Adding the following code to “functions.php” file of your theme will stop this function.

add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
   wp_deregister_script('heartbeat');
}

18. Warnings for using fonts

You need to be careful if you want to use any font that is not already associated with your theme. Many times, the user’s PC does not have the font your theme uses, so your site conversion rate can be reduced due to the delay in the loading of the font file.

Google has some free fonts, which we all use. But did you know, it takes time for these fonts to load from Google servers into your site via DNS Lookup?

Best of all, if this font is embedded on your site and loaded from the local server.

Similarly, when using FontAwesome’s icon, also increases the loading time of the site. You can use Font Awesome’s free CDN to reduce this time.

This link should be placed in the theme’s header.php file as follows:

https://opensource.keycdn.com/fontawesome/4.6.1/font-awesome.min.css

It should be placed in the middle of the <head> tag.

19. Use gzip compression

gzip compression is a very useful thing. Those who are using cPanel can easily launch this option from there. As a result, the content of your site is compressed and sent to the visitor, which reduces the load on the server. The browser then decompresses it and shows it to the visitor.

You can use the following code to enable compression on the Apache server and the Nginx server:

Apache server (must be placed in .htaccess):

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  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/x-javascript
  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/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

Nginx server (place and save it in your “nginx.conf” file):

gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;

20. Find and fix your slow pages

Find and fix your slow pages

The biggest thing is to find out which pages on your site are slow to load and fix them one by one. If you use Google Analytics, you can easily take data from there.

Google Analytics > Behavior > Site Speed > Speed Suggestions

Now, follow the suggestions and try to increase the speed of the site.

When talking about the page speed of a site, not only just the home page, each page is considered individually. For that reason, many times you can see, the main page of the site does not rank, but many pages within the site are ranked.

The optimization methods mentioned in this post are very basic. Those who know a little about servers and coding can work further to increase the speed of the site in many ways.

Category WordPress

Leave Your Comment

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