--> -->
Sun

How can I speed up my slow loading WordPress website?

Wordpress Website
July 16, 2020
Author: Hamster, www.hostens.com

A quick website helps you find information faster and save time for visitors. Saving 2 seconds to load the site allows you to easily save people about 2 minutes of working with your website. WordPress optimization and acceleration are possible thanks to very simple methods. Let’s check them out!

Although WordPress is lightweight and fast by default, setting it up incorrectly can make many processes slow and extremely confusing. Hamster suggests paying attention to ways that will help speed up the website.

Understanding website speed terms

First of all, let’s take a look at some facts related to the speed of a site’s loading pages. Without knowing these facts your understanding of what a fast site means will be incomplete:

  • site loading speed is measured by seconds
  • it depends on the region in which the site loading speed is tested.
  • website loading speed is the speed of loading not only the main page but each of individual page of the site
  • the speed of loading the page of the site during the first testing (or during the early testing after clearing the cache) can be significantly lower than the loading speed in subsequent tests. This is a sign that you have your caching configured – and this is good.
  • 70 points on PageSpeed ​​Insights on a mobile device and a desktop or 2 seconds of loading are perfect results. Do not get too hung up on the site’s speed optimization.

Use monitoring tools to check current speed

To begin with, you need to measure the page size and the speed at which it loads. Certain useful tools, such as Pingdom and similar ones will be very helpful in solving this problem:

https://developers.google.com/speed/pagespeed/insights/

https://tools.pingdom.com/

https://gtmetrix.com/

Hamster recommends using the Pingdom Website Speed ​​Test tool to check the speed at which specific pages on your site load. During the test, you need to check different pages for the same data center.

Enable files compression

It would help if you started with the maximum compression of those files that can be compressed using archiving tools. This way you will make sure that pages and site elements load much faster. GZIP is a file format, as well as a software application used to compress and decompress files. GZIP compression is enabled on the server-side and allows you to reduce the size of your HTML code, style sheets, and JavaScript files. It does not work with images since they are already compressed in a slightly different way. Compression allows you to reduce page sizes up to 70%, as evidenced by practical examples. This is probably one of the easiest optimizations you can do on WordPress.

Use CloudFlare

CloudFlare is gaining popularity among WordPress users. The reason is simple – their CDN network is working, and it is free. With added protection against spambots, CloudFlare is an excellent opportunity to add WordPress to your installation.

Learn more about how to speed up a website with CloudFlare here.

Turn on caching for static content

There are a lot of hidden processes going on at the time your WordPress site loads. In particular, PHP functions and queries to the MySQL database are executed. And depending on the work of these functions and requests, specific tasks are performed.

Using the plugin for caching will not only make website loading faster but also reduce the load on the server, memory, and processor. There are some cool plugins for caching, but Hamster would like to recommend W3 Total Cache separately. After installing it, you can enable caching in the Performance → General Settings tab.

Check your themes and plugins

Many site owners do not know or do not understand that many plugins (including libraries and plugins connected to the topic) negatively affect page loading speed. Turn off unnecessary heavy plugins.

Reducing and consolidating CSS and JavaScript files

Cleaning junk code from CSS and JavaScript files will make them smaller and allow them to load and execute much faster. The smaller size and number of files, in turn, reduce the number of page requests. These factors are essential to speed up the loading of the pages of the site as a whole.

You can reduce the size of the stylesheet manually using the online minimizer for CSS and JavaScript, and you can also assign this task to a particular plugin. Here is such an option for the plugin: W3 Total Cache. Remember to check the site after this minimization. The main thing is not to damage anything with such optimization of scripts and files.

Optimize Your Database

There are several plugins that can take over the optimization and support of the WordPress database. I will list some of them, but if you search the WordPress Plugin Directory, you will find many more.

Please note that many great “optimizing/caching plugins” that help with caching and similar things already offer optimization. So if you have a caching plugin installed, this issue may already be resolved. Advanced users can use PHPMyAdmin to optimize their WordPress database.

Declare a constant for the most commonly used values ​​in the database

For developers, a useful tip might be to reduce the number of database queries. You need to use some WordPress features that are called most often and more than once per page.

For example, to get the address of the home page, we usually use

get_option (‘home’);. This function requests the database and receives the value we need from there. We know that it will be the same every time, and we may need this value in different places.

What to do in this situation?

Usually, users create a new constant in the wp-config.php file like this:

1 define (‘MY_HOME’, ‘http: //www.yourdomain.com’);

2 define (‘BLOG_NAME’, ‘Expert Developer’);

After declaring this a constant, you need to use it instead of get_option (‘home’) or a similar function. This will reduce the number of database queries on the page. You can also set constants for the template directory.

Important! Be careful

When using plugins to compress styles, the CMS template can break, since you need to follow a strict order of connecting scripts.

When using plugins for JavaScript, the functionality of the site may be disrupted, and this may not always be obvious at the very beginning of optimization.

There is a certain risk when updating CMS and plugins. Very often, CMS developers include new functionality, and older sites do not always need this functionality, for example, the WordPress development team have recently included links to the google fonts service in a box, and on the old site these fonts will most likely be unnecessary, everything is already there.

When it comes to themes for CMS, whether WordPress or another one, developers are trying to make the template flexible in customization so that the template owner can adapt it as he/she wants. Still, the size and number of styles will be much more significant. For example, a website made in manual styles and scripts can take up 40-50 kb in total. At the same time, I have encountered themes in which scripts and styles took more than one megabyte.

 

Related articles

Have any questions? Do not hesitate to contact us!