No one likes slow websites. So, let’s dive into WordPress and web server structure and figure out, how we can boost our website.
The GTmetrix tool helps us find problem plugins. They are not actually a problem, but if we can, we must avoid their usage. For example wordfence, visual composer, or gravity forms.
I don’t recommend using page builder-based themes. The best place to find a minimalistic and free one is the WordPress’s official repository.
Firstly ensure that you use at least PHP 7 on your webserver. An important point: the new version of PHP may not work correctly with the old installations on the site. This happens in cases when the user does not update for a long time, plugins, templates, so the stages of updating and checking plugin compatibility cannot be skipped.
Let’s manage our assets
Images require additional resources if placed on a metadata page and not compressed. What do we need to know to optimize images? The most convenient format is JPG. The ideal guideline for file size is 70 KB. Service I use – TinyPng.
Protecting dashboard from malicious requests
Some requests to the site are malicious or just happen too often, which not only creates a load on the WordPress server but also leads to the loss of access. We edit wp-config.php and wp-login.php files. We can access them only from one IP. Changes we made we save in .htaccess file.
Filter all the incoming requests and messages
An extra load on the CPU is also created by queries to MySQL lasting from 0.5 seconds. Time limitation is made in robots.txt:
User-agent: yandexbot Crawl-delay: 10 #
So, the search bot will not stay on the site for more than 10 seconds. To restrict all bots at once, change the name of a specific agent to *.
To block requests from a specific IP, write the following in .htaccess:
Order Allow, Deny Allow from all Deny from 18.104.22.168.
One more thing
Sometimes WordPress server load occurs due to errors in the logs addressed to wp-cron.php. In this case, we need to install WP Crontrol and reset all related events.
At the begining of functions.php file we add:
update_option(‘cron’, » «)
Then we enter to the website, visit some pages and then delete this line of code. That’s it.
P.s. Thanks to Timeweb.