The most important procedures for speeding up a WordPress site | Comprehensive guide
speeding up a WordPress site
Increasing the speed of your WordPress site is one of the most important factors that you need to consider, and strive to improve it continuously, and this is what we will learn about today. I’ll show you some recommended optimizations to make your site faster, as well as a better user experience.
Prepare your favorite drink now to start reading this step-by-step guide, which shows you all the steps to improve your site speed🙂
The importance of site speed
There are many benefits to your site if its speed improves significantly, but the loading time will be less in front of the visitor, but there are more benefits that your site will get after improving its speed, as follows:
- Improved ranking in search engines: Google’s search engine disables the priority in search results for sites that have a faster loading speed than those that take a longer time to load.
- A better experience for your visitors: There are many studies that have been conducted that show the possibility of losing a large number of visitors to your site if the site load period increases. Therefore, in order to preserve this valuable wealth of visitors, you must give the matter full attention.
- Better experience for e-store owners: Online shoppers prefer e-stores that fulfill their purchases in record time, so this is also important to you if you are an e-store owner.
The most common reasons for a slow WordPress site
- Choosing an unstable or properly configured hosting.
- Using a bad wordpress template that is not designed in the best way that helps to speed up the site.
- Installing add- ons that are not optimized or not well programmed.
- Using large pages that contain improperly formatted files, images, or videos.
- Calling external files within the External Scripts site.
How do you test the speed of your site?
The speed of the site is not measured by the speed you see when browsing your site, because you open it repeatedly all the time. A ready copy of your site’s content is stored by the browser, and then the browser displays that saved copy when you enter your site, so you find that the site is fast, but it is not the true speed of the site .
But for regular visitors (especially new visitors), they browse the site at its real speed, and therefore we advise you to use some tools to find out how the site’s speed will be for users, which are as follows:
- isitwp is a tool to measure site loading speed and provide tips on how to improve speed.
- gtmetrix tool that helps you analyze site speed and give you a full report for some recommendations to speed up your site.
- Page speed tool from Google, which provides a percentage rating on site speed and provides some recommendations for improving site speed.
Also, here is the following image showing a site test in one of the speed measurement tools, and as you can see, the site load time is 1.17 seconds, and a link appears with suggestions for improving site speed.
Most of the time you open these suggestions and don’t understand what is required of them, especially if you don’t have a programming background! . But after reading this article, everything will be completely clear for you to improve the performance of your site step by step.
Note : If your site load time is more than 2 seconds, it is necessary to optimize your site speed for less than that time.
Speed improvement by hosting provider
The process of improving site speed begins with choosing reliable hosting for your site, as your site is directly affected by the resources of that hosting, its stability and speed of performance, so you must invest well and choose the appropriate hosting.
Shared hosting is the most used among users of emerging and small sites, and it is called shared hosting because the hosting company in this case divides server resources into a large number of shared hosts and sells them individually to a number of clients.
Shared hosting often fails to provide high site loading speed and complete stability if there is a large number of visits within the site.
If you intend to create a site for a large business and has a lot of financial and technical dimensions, we do not recommend this type of hosting, because your site is subject to any error that occurs on the server that contains it within the hosting company, and a problem may occur in your site due to a breakdown or a suspicious thing. In some other sites hosted on the same server.
This does not mean that you should start using shared hosting, but with ensuring the reliability of the company you are dealing with, and that the company has stable and strong systems and provides periodic software updates, as well as continuous technical support and backup services. Taking into account the recommendations mentioned in the article, you will find better performance for your site.
Now, here are the most important steps that you need to make sure of by the hosting service provider, as they are the main ones that you depend on for the speed of the site:
1. Choose a reliable hosting company
The first thing you care about is relying on a reliable hosting service provider, both in terms of the reputation of the company you deal with or in terms of its history with customers who dealt with it in the previous period, the more there is confidence by users in the efficiency of the hostings provided by the company, the more it is expected That you also get a better experience from your service provider.
Also Read: IP address for your site to enhance security and protection
2. Get the latest version of PHP
PHP is the source programming language in which the WordPress system was built and established. It is also used to program templates , plugins, and the entire WordPress system .
Every period of time a newer version of PHP is released which includes solving a lot of problems in the previous versions. So make sure your hosting company provides PHP version 7 to later.
3. Support Http/2 . protocol
The HTTP/2 protocol is one of the protocols that helps improve the speed of your site significantly. If the hosting company provides it to you, it will reflect on the performance of your site, as the HTTP/2 protocol, which was launched in the year 2015, allows the transfer of information in more flexible ways and in less time. , which is reflected in the speed of loading your site.
4. Choose the server closest to your visitors
Many hosting companies provide the ability to choose a server in a specific geographical area, in this case we advise you to choose the server that is located in the place closest to your visitors. For example, if you are targeting visitors from the Arab Gulf countries, it is better to choose a server located in “Bahrain”, for example, rather than a server located in “United States”.
Certainly, this is if the hosting company provides servers in that country, and in all cases, choose the place closest to your visitors, and the server located in one of the European countries may be the closest to your site visitor than the server located in Australia. As this easy and simple procedure can affect the loading speed of your site significantly.
Note : You can find out the countries that bring you the most visits to your site by using many statistical services such as Google analytics, and then you can determine the most important areas from which visitors come to your site and thus you can determine where your site should be hosted in order to load faster for the most important visitors.
Top tips to increase the speed and performance of the site
WordPress consists of many pages, files and plugins, which may constitute a great burden on sites, and therefore you need to organize the structure of the site and deal with it in a way that helps to load and appear your site to the visitor in the least possible time.
Now we begin to explain all the necessary procedures for you to speed up your WordPress site to the highest possible degree of speed in performance and visibility.
1- Customizing Cached files
Storage files or the so-called “cache” are files that are automatically generated when any visitor enters your site, for the purpose of quickly displaying the contents of the site if the visitor enters the site the second, third or fourth time of his visit. Therefore, cache files help improve the speed of loading your site in front of visitors who frequent the site, instead of consuming your site server resources in fetching all files and data to display to the same visitor more than once.
As you can see in the picture, the first step is when the visitor enters your site, the second step begins where the cache files are automatically generated and stored in the visitor’s device, and the third step comes when the visitor repeatedly enters the site again, the cached copy of the site is loaded very quickly This makes your site appear much faster than usual.
This means that you need to configure the cache files on your site, and of course there are plenty of free plugins that help you do this task easily with simple steps.
As for the free add-ons, there are many add-ons that you can use completely free of charge, such as the Wp Super Cache add-on or the W3 Total Cache add-on.
You can also try Cloudflare’s free add-on, Wp cloudflare , which provides an automatic cache file generation service for site visitors.
There are also “paid” plugins that provide higher site acceleration features along with automatic cache generation, such as Wp Rocket , which provides you with some additional options, such as delaying the loading of images inside your website pages or what is known as Lazy load images, as well as providing services CDN, which we will talk about in some detail throughout the article:.
Note : There are some hosting companies that provide automatic and completely free cache services with the hosting plan that you are working on, and in this case you will not need to add WordPress to do this, but what you need if your hosting supports the creation of cache files is to enter the settings Your hosting is in your hosting company account and activates the Cache Files feature.
For example: Bluehost provides this feature. You can activate the feature by logging into your account, then going to My Sites , then the Performance tab , and then activating the Cashing options as shown in the following image:
In this case, you will not need a WordPress plugin to create and manage cache files.
Also, if you are subscribed to a hosting company that provides pre-managed WordPress sites, these companies often provide an automatic cache file system, so whatever company you work with, if they provide you with automatic caching options, you will not have to install an extension dedicated to it.
2. Optimize and adjust image sizes on the website
Images are one of the most important elements that need to be configured on your site, because your site will not be free from the fact that it contains many images, in most of its pages. If the image is many and large in size, this will negatively affect the speed of your site.
You can control the size of the image via Photoshop, or perhaps you can use the Tinypng tool , which helps you reduce the size of the image by uploading it to the site, then the site compresses it without losing its quality and uploads it to the lower size.
As in this example, the image size has been compressed by 73%.
We recommend using JPEG or PNG images, and JPEG is more preferred. If there is no need for other extensions, you can also rely on some free WordPress plugins that provide options to improve the appearance of images within your site, and one of the most famous of these plugins is Autoptimize , which provides the Lazy load images feature that helps web pages to load and appear first, and then the Loading images successively one by one, which helps to speed up the loading of the site for the user.
There are also some add-ons that are used to delay the loading of comments, where the comments are hidden and not loaded once the site is loaded, but are loaded automatically if the visitor reaches the comments section at the bottom of the site.
This procedure benefits the owners of large sites that contain thousands of comments, which helps reduce the number of comments displayed on the same page, and thus improve its performance. As for small sites, there is no need to use the add-on hiding comments because it will not have a significant impact.
To make a comment load delay, you can use the Lazy load comment add-on
After installing and activating the plugin, you can access its settings through the WordPress dashboard << Settings << Discussion
As you can see in the picture, you will find 3 options as follows:
- The first is On Scroll: when you choose it, the comments will be hidden and shown. Just scroll the visitors inside the site and reach the comments section.
- The second, Onclick: When you choose it, the comments are hidden and the “Show Comments” button is shown. When you click on it, the comments begin to load and appear.
- The third No lazy load: When selected, the extension will be turned off.
You can also use the Smush add-on to do an image and media optimization optimization work. The add-on has a lot of image optimization options such as:
- Lazy load technology to delay the appearance of images until the visitor reaches them
- Lossless Compression . The ability to compress images and reduce their size while maintaining their quality
- The ability to compress a number of images up to 50 images with one click of a button at the same time.
- The extension scans website images and identifies images that are causing a slow website loading.
- The add-on has a free version with some good features
3. Get the latest updates
Updating WordPress is one of the most important practices that not only help boost the loading speed of the site, but also maintain the security of the site and its information , as WordPress updates always come in order to solve the problems that users were facing in older versions.
For example, when the WordPress version 4.2 was released, it came with a technology that helped site owners improve the speed of loading their sites in an unprecedented way, as the performance of the JS code inside the site rules Menu was improved.
Thus, the rest of the updates come in order to provide speed and security options for the site, which makes it necessary to constantly update the version of WordPress and all site files.
4. Be careful with plugins running in the background
There are some plugins installed on your site that run in the background and consume your site’s resources, thus increasing its loading time in front of visitors.
Of course, this case occurs, for example, when you install one of the extensions that implement many functions within your site, for example, the extensions that take backup copies of your site continuously and intensively, the operations that these add-ons perform clearly affect how quickly your location.
Therefore, it is good to make sure that the backup addition that you use makes backup copies in times when there are not large numbers of visitors, it will be useful in the efficiency and speed of loading your site.
5. Set the display of the summary of articles instead of displaying their full content on your pages
WordPress automatically displays the full content of the articles on the home page or the archive page of your site, and certainly displaying the full content of the articles automatically causes an increase in the loading time of the site, as these articles contain many image files that may make the loading time much more than usual .
Therefore, activating the option to display a “summary” or clipping of the content instead of displaying the entire content “which appears as an excerpt from the content, and the visitor can view the full content of the article by clicking on the article title easily.”
To activate the option to display the summary or summary, go to your WordPress dashboard, then go to Settings << Read and then at the option “Include for each article in the feed” you will select a summary (Summary).
You can also contribute to increasing the speed of loading your site by displaying fewer topics per page, for example displaying only 10 articles, and the visitor can access the rest of the articles by scrolling the navigation bar between pages.
6. Limit the number of comments displayed within a single page
If there are many comments that appear at the bottom of one of your articles or pages, and every time a visitor enters this page, all the huge amount of comments inside the page are called, which makes the site take more time to load and appear in front of visitors. The solution is to set a maximum number of comments that appear at the bottom of your articles or pages, and then divide the rest of the comments into multiple pages.
To activate the option to divide the number of comments that are displayed, enter the WordPress dashboard for your site, and from the bottom of the settings tab, choose << Discussion “and then “Select the number of comments per page”, for example, to be 50 comments maximum. Older comments will be split to other pages the user can navigate
Note: This procedure is for large sites that contain tens and hundreds of comments. As for small sites, there is no need to do this procedure.
7. Connect your site to CDNs
We also explained that the location of the server will affect the speed of browsing the site according to its location for visitors, and therefore if your visitors are distributed over different countries of the world, the speed of the site will vary according to the approach or distance of visitors from the server location.
For example, if your site is hosted on one of the servers of a company in the United States of America, this helps visitors from the United States to enter your site more quickly than visitors from Egypt because of the far distance between Egypt and the United States. So, the geographical distance of the server from the visitor contributes to the time of loading the site for the user, and this explains the speed of loading sites for all visitors in the countries where the most famous web hosting companies are located.
CDNs and their role in accelerating the site
As we talked about at the beginning of the article about cache files, CDNs work with an idea similar to the idea of cache files, where an exact copy of your site is uploaded to a large group of servers in different parts of the world, for example a copy is stored on a server in the “United States.” As well as on a server in “Kuwait”.
In this case, if a visitor from the State of Kuwait enters the link of your site, the copy of the site stored on the server located in the State of “Kuwait” will be downloaded to the visitor instead of the copy stored in the “United States”. Which greatly contributes to improving and speeding up your site wonderfully.
There are more than one CDN service provider around the world, and we can refer to some of the most famous providers, such as Cloudflare , which offers one of the most popular CDN services:
There is also a company stackpath (formerly MaxCDN) which provides CDN services as well
8. Upload large video and audio files to an external provider
WordPress allows uploading video files as well as audio to your site’s content and embedding it directly, but we do not recommend this, especially in large files, as this causes the consumption of hosting space, and also increases the time it takes to download the file.
Instead of uploading video and audio files directly to your site, you can upload those files to YouTube (or any external provider), and then embed the video directly into your site so that the video plays inside the content without consuming any of your site’s resources.
9. Choose the perfect template
The WordPress template is one of the pillars of building your site, it is responsible for customizing the appearance of the site and sometimes adding features, so choose the most suitable template for you carefully, taking into account security, speed, flexibility, and programming the template well. Here are the most important tips for choosing the right WordPress template for your site:
- Good performance : The ideal templates are simple and uncomplicated, so don’t be fooled by templates that provide you with dozens of plugins and options that you don’t really need, in addition to being a huge burden on your site’s resources.
- Responsiveness : In our modern world, you no longer have an option to make your site responsive to all types of screens such as tablets, mobile phones and various screens, so make sure before installing the template on your site that it is responsive. You can test the template before installing to make sure that it is compatible with all types of screens, using one of the tools, the most famous of which is Google Mobile Test
- Template compatibility with plugins: Before installing the template, make sure that it is compatible with the most important and popular plugins that you will resort to installing and using on your site. Some templates are not compatible with certain plugins, which causes site loading problems and other security issues.
So choosing a template that is professionally programmed mainly affects the speed of your site.
10. Delete unused and inactive templates and plugins
It is possible that there are some plugins inside your site that are not activated and you do not need them. In this case, it is better for you to delete these plugins permanently from your site, and remember that any files you do not need are an additional burden within your site. So get rid of things you don’t need constantly.
11 . Remove junk data from databases
When you delete an article or page or delete any content from your site, it is stored inside the databases automatically so that you can restore it afterwards if you want, and therefore if you delete large amounts of content inside your site, there is a copy of it inside the databases and it constitutes an additional burden on your site and thus affect its speed.
The solution if it is to clean the databases of those files and junk content, and you can do this using some custom plugins such as the Wp-sweep add-on
After installing the plugin, you can access its settings from within the WordPress dashboard, then go to: Tools << Sweep
td file inside the settings page. In addition, you will find a lot of things that have been deleted from your site and still exist and are stored within the site databases, as you notice in the picture those things such as content reviews, drafts, deleted articles, annoying comments, deleted comments, duplicate content, and dozens of things Unimportant, which you can delete by pressing Sweep directly.
Read also: Creating a WordPress Blog from A to Z (Updated 2022)
Make some advanced settings
In the previous parts, we reviewed the most important simple steps that do not need you to write a code book, and which do not need to learn some advanced techniques or skills, and indeed all of those steps have a lot of effect in improving the speed of your site well.
But in this part, we will focus on some advanced things that double the process of improving site speed, but we advise you to be careful while making these adjustments, because any mistake in them may cause a complete failure of your site.
Note : We advise you here to take a backup copy of your site files and databases before you make any changes to the code within your site in anticipation of any malfunction that may occur.
1. Split the content of your articles and long pages into multiple pages
Do you have an article on your site that exceeds 5 thousand words or maybe more?! Yes, in this case a large amount of data, images and comments will be loaded into your page every time a visitor enters that page.
In this case, we advise you to divide that content into multiple pages. The visitor clicks on page after page in order to show him the rest of the content of the article or page.
To do a division of the content of your articles or pages, you may enter the edit page of the article you want to split its content, and on the editing page open the “Text” tab to open the HTML code editing page (this is in case you are using the traditional editor)
If you are using the “Gutenburg” component editor, you can open the HTML editor by opening the editor options and selecting “Code Editor” as the following image shows:
Browse the content of the article until you reach the part you want to separate and divide the rest of the content on a new page, and you put the following code:
If the code does not work perfectly, you can place the cursor at the position you want to separate and press Ctr+Alt+b on the keyboard, and you make a save to notice that the content of your articles has been divided into two pages instead of one page, and you can increase the number of divided pages by adding the same tag in any A place where you want to separate.
2. Reduce database queries
WordPress is built in a dynamic way, so that all orders are executed on the site even if the site data changes from time to time. In the sense that there are tens and hundreds of programming functions that each perform a specific function when a visitor enters the site, for example there is a function called language_attributes and this function brings the direction of displaying the components of the site, whether from right to left or from the opposite, based on the default language of the site Which was selected during the installation stage of WordPress, or was customized from the WordPress settings after installation.
Note the following code:
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php language_attributes(); ?>">
In the previous code, the function Make a query to the database in order to find the default language of the site, imagine that a million visitors enter your site daily, and every time a visitor enters the site, a function is run that makes a query within the databases to search for the language of your site, and in the end the language of the site It is a fixed thing and can be added to the previous code without having to run a query function to the databases in order to get the same thing every time!
The code can be modified to:
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php language_attributes(); ?>">
ltr indicates that the direction of the site is from left to right, but if your site is in Arabic, the definition can be used RTL.
In the end, you provide the value of the constant that the function makes tens and maybe thousands and millions of queries to the databases in order to get it. Thus, when the database queries on your site are reduced, the matter will be reflected in the speed of your site.
3.Reduce the number of saved revisions
WordPress automatically saves incomplete modifications within your site, and copies of those modifications are stored inside databases, which may be large amounts of content, images, videos, etc. It is extra bulky and consumes your site resources as well and in the end this may affect the loading speed of the site.
Therefore, it is important to reduce the number of copies saved within your site to the minimum possible, and you can see how to reduce the number of copies saved automatically through the Wp-config file .
4. Block External Websites From Hotlinking Your Website Files
Some competitors may steal images from your site and embed them on their sites via the link, in this case that image is loaded inside their site but consumes your server data, thus affecting your site performance.
This process is called Hotlinking, and it consumes a lot of your site’s resources and causes your site to slow down and possibly crash if there are large numbers of external Hotlinking queries to your site.
We recommend that you learn how to block external sites from hotlinking with an .htaccess file.
5. Disable Pingbacks
Pingbacks notifications in WordPress is a technology that sends notifications to other website owners who have added their links to their sites within your site, as well as receives notifications from those who have posted links to your site.
This is certainly not useful in WordPress and constitutes an additional burden on the speed of the site, because it makes queries from within the databases. Thus, you can access your site’s link information to other sites through the Google search console and Google analytics.
To disable these notifications, you can go to the WordPress dashboard, then go to Settings << Discussion , then uncheck the “pingbacks” option as the image above shows.
6. Changing the MyISAM storage engine inside the database tables
When you go to the PHPmyadmin database manager and open a database to see the tables inside, you will find the figure in the image above, but note that the shaded in red indicates Storage engine and in this case its type is MyISAM. So what’s the problem?!
The problem is that the MyISAM storage engine is rather old, and there is a newer type of it called InnoDB. This type of database storage engine has been proven by many studies to help speed up the site significantly.
The reason the InnoDB type is best for your site’s databases is that it uses the query known as row-level locking, while the MyISAM type uses the query known as full table-level locking.
The advantage of the InnoDB type is that when a query is requested from a site page to a particular data within a table in the databases, only the requested data is loaded, while in the MyISAM type the whole table data is loaded, which causes extra load time for your site.
How do I change the data storage engine from MyISAM to InnoDB?
Go to the database manager and choose the database that contains the data tables for your site.
Then enter the table whose type of storage drive you want to change. For example, we enter the table shown in the image wplw_comments. It opens the table settings modification page:
Go to the Operations tab, and the Storage engine section will appear in front of you:
Open the checkbox and choose InnoDB instead of MyISAM.
You can repeat the steps on the rest of the tables for which you want to change the storage drive in the same way.
In the end, we hope that we have clarified all the important things to improve the speed of loading the WordPress site to the maximum extent possible. Caching and other technical matters such as blocking Hotlinking, reducing database queries, and certainly we do not advise you to take actions that need to modify the code unless you have sufficient programming experience to do so, and we also advise you to take a backup copy of the site before making any software change.
Professional WordPress as he likes our site to be specialized in WordPress to make a professional site