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:
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
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.
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.
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.