WordPress speed optimization - how create a fast WebSite?

WordPress speed optimization - how create a fast WebSite?

Optimization of the WordPress speed is a complex issue and can be completely solved only by working through all levels of the website. A fast site improves the user experience, increases conversions, and allows you to serve more users on the same budget. In this article, we will give all the basic steps that affect the performance of your site.

Choosing a server and its location

The basic thing will be the choice of hosting and server location. No matter how well you optimize your site, if it is too far from your user, large network delays can neutralize the desired effect of optimization.

For example, a well-optimized site can return an html page in less than 100ms, while the network delay between Frankfurt and Washington can be over 150ms. As a result, most of the resource load time will be network overhead.

But if your target audience is from the USA, then for example, the ping between New York and Washington can be less than 10ms. Therefore, it is very important to choose a server as close as possible to your users.

If your audience is distributed evenly around the world, the decisions will be more complex. In this case, a CDN (such as Cloudflare) that has servers in different regions of the planet can help. Statically, resources, such as pictures, etc., will be given with the CDN server. if you get confused, you can implement caching of all content on the CDN servers, which will greatly reduce the load time of your site for users from all over the world.

Ping between different cities

Also, when choosing a server, pay attention to the additional functionality that the provider provides. For example, important options will be the ability to quickly resize the server and automatic backups.

To create a site on WordPress, you can choose a provider from which you can deploy a ready-made server with WordPress installed or a clean VPS. The second option is suitable for advanced users and allows you to install and configure everything on the server yourself.

For a small site that does not have a lot of traffic, a server with 1 or 2 processor cores, fast SSD disk and 2GB of RAM will be enough. If the traffic increases, you can always increase the server to the required size. This will allow you not to overpay at the start and scale server costs in proportion to traffic.

Necessary software on the server to create a fast WordPress site:

  • Nginx as front server
  • PHP 8 or newer. It can be PHP-FPM, Nginx Unit, etc server with opcache enabled.
  • MySql or MariaDB server for database
  • Redis for caching data

Read more: Using native Linux cron with WordPress to improve website performance

Theme optimizing

A lightweight and well-coded theme is one of the keys to a fast website. Even paid themes will most likely have to be optimized to suit your needs in order to remove unnecessary functionality and make sure that nothing extra takes time.

The most common problem is optimized or repetitive queries to database. For debug you can use Query Monitor plugin.

Also a big problem of many themes is a large number of js plugins that connect when needed and when not. You can use a bunch of chrome dev tools and Query Monitor plugin to track such scripts and turn off loading unnecessary ones or make them load only on the necessary pages.

Read more: How to remove jQuery Migrate from WordPress site?

You can use the lighthouse to help you analyze downloadable resources фтв other performance issues. You can also find it in Chrome Dev tools.

Remove unused plugins

The more plugins you have installed, the more resources will be used to load the page. In addition, there is a higher probability that one of them has a vulnerability. Therefore, it is important to remove unused plugins and update installed plugins in time.

Use caching plugins

Use a caching plugin such as WP Super Cache, W3 Total Cache, or WP Rocket to speed up your website.

For example, the results of database queries can be cached in Redis. The greatest increase in the speed of return html page will give the caching of the entire page with the return of the result directly by Nginx without the participation of php.

Minify CSS and JavaScript

Minify your CSS and JavaScript files to reduce their size and speed up your website. It is also important to reduce the number of such resources by combining them into one file.

Check your http expires headers

Static resources that change very rarely (images, js scripts, css styles etc) should be given with an http header:

cache-control: max-age=31536000

This will prevent the user from reloading these resources and significantly increase page rendering speed. if you use CDN - such resources will be downloaded directly from the CDN servers.

To quickly update such files, you can use versioning by adding a get parameter to the file name:

somescript.js?v=21

Read more