The web is teeming with tips and tricks on how to optimize your WordPress performance. Unfortunately, explanations and evaluations of the relevance of the various levers can quickly fall by the wayside. We show you the important starting points and levers - in a sensible order and with context. This will help you achieve success particularly quickly.
We have now hosted a lot of WordPress projects. This has generated a lot of data. And we are constantly being asked how the loading time of a WordPress website can be further reduced. So we have systematically processed our findings from the past few years. The result: 10 measures you can use to quickly and easily optimize your WordPress pagespeed.
One thing is particularly important here: some people are quickly put off by the optimization suggestions from tools such as Google PageSpeed Insights. Let me tell you: You won't make the most loading time gains with complicated optimization measures, but with methods that are very easy to implement.
Of course, load time optimization is not an end in itself. In addition to a better user experience, a shorter loading time also benefits the visibility of your website on Google. For this reason, I will also briefly outline what the individual optimization steps are actually about for each point in order to create the appropriate context.
In theory, you can work your way from top to bottom and improve the loading time of your website step by step. Incidentally, the first seven points also refer to the typical improvement suggestions from Google PageSpeed Insights, which we discuss in more detail in this article, for example.
#1 Caching - the most important performance factor for fast loading times
Caching means that your page does not first have to be requested from the web server by the browser and then built up step by step. Instead, your page - fully rendered - is loaded from a cache.
The advantage of this caching is obvious: WordPress does not have to recalculate your page every time it is called up. Since WordPress is based on the very slow PHP, a cache is essential here. Among other things, it prevents PHP from having to be read out.
In principle, there are two implementation variants for caches:
- About caching plugins: The majority of users use a caching plugin, such as W3 Total Cache or WP Super Cache. These are sometimes easier, sometimes a little more complicated to set up. In any case, a certain amount of manual work is required here.
- About the hoster: Some hosters - including Raidboxes - offer server-side caching. This means that you can almost always do without caching plugins. This is because your hosting provider has already configured the cache for you.
If you have set up high-performance caching, you have already taken the most important step towards optimizing WordPress. For more details, take a look at our article on caching basics.
#2 Tidying up WordPress - order is a must
In our experience, one of the most common causes of long loading times is an overloaded WordPress installation. And because this improvement point is not mentioned by Google PageSpeed Insights, it comes in second place in my top 10.
An overloaded WordPress installation means in the vast majority of cases: There are too many plugins installed. Basically, the fewer plugins, the faster the website. Of course, plugins are important and you can't do without them, but you should always check which plugins you really need.
And: You should make sure that you don't just deactivate plugins, but actually delete them completely.
The same applies to themes: you don't need more than one.
The background is as follows: Every plugin and every theme adds PHP code to your website. This also applies to deactivated plugins. This makes your website bulkier overall and therefore slower (and more susceptible to attacks). This is because PHP is a very slow scripting language. The less of it there is, the better.
Plugins and themes that are no longer needed are often left over from function and design tests. It is therefore a good idea to clean up your WordPress websites regularly and you should also test new functions and designs in a test environment and not on the website itself. This will prevent you from accumulating too many plugin remnants in the first place.
#3 Images: the underestimated load time brake
One of the most effective and simplest measures to reduce the loading time is to reduce the size of images. This is because you can sometimes save large amounts of data. Lossless image compression reduces the file size of your images without any visible loss of quality. This means that your page hardly changes at all, while at the same time you can significantly reduce its size through image optimization.
Images often make up the largest proportion of a website's data volume. Reducing the size of your images should therefore be one of the first optimization steps. You can either optimize images manually or you can use a compression plugin for this.
Using a plugin is certainly the more convenient solution. This is because plugins not only allow you to compress new images and their thumbnails, they can also automatically compress all existing images on your website. However, this service is often subject to a charge.
#4 CSS and JavaScript - sounds bulky, but is easy to optimize
The second largest amount of data on your website is usually JavaScript and CSS files. This is where many people are particularly afraid of getting involved. But even without code expertise, you can easily understand what CSS and JavaScript optimization is all about. In principle, there are three things to do here:
- Summarize: CSS and JavaScript are hidden in many small individual files. Normally, each of these files must be requested individually from the web server by the browser. This generates HTTP requests that tend to increase the loading time of your website. However, if scripts are combined, the number of files to be loaded and therefore the number of requests is reduced. For example, 53 individual requests become just over a dozen. Of course, the corresponding plugins can also do this for you.
- Reduce: CSS and JavaScript files are lines of code that enable certain functions and designs on your website. This code is written by humans. However, it is read by machines. Why is this relevant? Much of what a human needs to be able to understand code correctly is not needed by a computer. Spaces, comments and the like are therefore not needed so that your page can be built correctly. This is exactly where plugins like Autoptimize come in. They convert CSS and JavaScript from human-readable to machine-readable code. This makes the individual data packages smaller and their transmission faster.
- Compression: After summarizing and reducing, the last step is to compress the data packets that are sent from the web server to the browser. This means that the server minimizes the file size of the individual requests and the browser unpacks and calculates them. This is faster than sending uncompressed data packets. You can set up GZIP compression using caching plugins, manual settings in .htaccess or your host has already activated compression on the server side.
Even without knowledge of the scripts, it is therefore easy to understand the benefits of the individual measures. And there are plugins for all three steps that enable even non-experts to optimize CSS and JavaScript. In our article on CSS and JavaScript optimization, we explain further details and present various plugins.
Four wins!
These were the four areas in which a particularly large amount of loading time can be saved. You can already optimize your performance with relatively little effort - by caching, image optimization, optimizing CSS & JavaScript and cleaning up WordPress, you can already achieve significant improvements.
#5 Hosting has a major influence on loading times
Although the first four optimization fields promise a particularly large reduction in loading time, they can come to nothing if your hosting slows you down. This refers less to the hardware requirements for WordPress, but rather to certain technologies that show you that a host allows you to optimize WordPress at all.
As a rule of thumb, you can remember that high-performance WordPress hosting should have these key data:
- SSD hard disk
- PHP memory limit of at least 64MB, preferably 128MB
- Data center in the geographical vicinity of your target group
- Current PHP version
- HTTP/2 and free SSL certificate
Then there is the difference between shared hosting and your own (virtual) server.
With shared hosting, you share the server and its computing power with other websites. Usually a few dozen to a few hundred. With your own server, you don't have to share the computing power with anyone. It therefore primarily offers the advantage of performance security.
Although having your own server is not synonymous with better performance, experience shows that cheap hosting tariffs in particular, which only cost a few euros a month, cannot keep up with virtual servers in terms of performance.
"*" indicates required fields
The finer points - less impact, more effort
All performance-relevant areas that I have mentioned so far can be optimized by almost anyone. Either via plugins, simple trial and error or the purchase of appropriate products. It gets more complicated if you have already optimized these areas. Because then you have to delve deeper into the site structure. And individual optimization measures no longer have the same impact.
#6 Render blocking - wrong loading order
One point that is repeatedly criticized by tools such as Google PageSpeed Insights is a loading sequence that blocks rendering.
An example illustrates the problem: A slider consists of images and the animation command that rotates these images. If the JavaScript command is loaded first and the images at the end, your page already has the slider function, but not the images that are to be displayed. The page will therefore take longer to load. This situation can be prevented by using the correct loading sequence.
Although there are plugins for optimizing the loading order, our experience shows that these are not always able to fully optimize your website. In such cases, the best results are usually achieved by a web designer who is familiar with the website and its functions.
#7 Above the Fold - optimize the visible area of the page
In addition to the total loading time of your website, the perceived loading time is particularly important. In other words, the time that is visually perceived as the loading time. This perceived loading time can be shortened with a few tricks. This gives the impression that the page is already fully loaded, even though calculations are still taking place in the background.
The optimization of the loading order is particularly important for the optimization of this area, which is known as Above the Fold. This means that content and functions that your visitors should see on the first screen size are prioritized.
You can achieve this by optimizing the loading sequence, for example. However, there are also plugins that ensure that your page loads more efficiently. And only the visible area in each case. a3 Lazy Load is an example of such plugins. This means that all content is always displayed, but the page load time can benefit from this, especially if it is an image-heavy page.
#8 Clean up database
In addition to images and scripts, your database can also become too large. There are practical tools to keep your database lean, including the WP-Optimize plugin.
#9 Pingbacks and trackbacks
By default, WordPress interacts with other websites that allow pingbacks and trackbacks. Every time your website or one of your blog posts is mentioned on such a website, your website is automatically notified - and this places an additional load on the database.
If you don't need this feature (the added value is negligible in my opinion anyway), then you should deactivate pingbacks and trackbacks. Again, the WP-Optimize plugin can help. For the sake of completeness, however, it must be mentioned at this point that this is more of a theoretical problem. We have not yet encountered any serious performance losses for this reason.
#10 Prevent hotlinking
Hotlinking means that someone links directly to an image on your server - effectively "stealing" your bandwidth. With an Apache web server, you can prevent hotlinking by adding the following code to the .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yourwebsite.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?google.de [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?google.com [NC]
RewriteRule .(jpg|jpeg|png|gif)$ – [NC,F,L]
To prevent hotlinking on an NGINX server, add these lines of code to your NGINX config file:
location ~ .(gif|png|jpeg|jpg|svg|webp)$ {
valid_referers none blocked server_names
*.example.com example.* www.example.org/galleries/ ~\.google\.;
if ($invalid_referer) {
return 403;
}
}
Breakdown of the code:location ~ .(gif|png|jpeg|jpg|svg|webp)$ {
specifies the file extensions that you want to protect from hotlinking, for example, if you want to protect PDF files, the code line would look like this:location ~ .(gif|png|jpeg|jpg|svg|webp|pdf)$
{valid_referers none blocked server_names
*.yourwebsite.com ~.google. ~.bing. ~.yahoo.;
These lines are somewhat extensive, but it helps you to better understand what you can do with this rule. These lines basically specify which domains are still allowed to hotlink your files. In this example, yourwebsite.com with all subdomains, as well as Google, Bing and Yahoo.
if ($invalid_referer) {
return 403;
}
If a request comes in and the request resource is NOT in your whitelist above, the server returns a 403 error (Forbidden).
Other methods to prevent hotlinking
There are numerous security plugins in the official WordPress plugin directory that you can use to prevent hotlinking - for example All In One WP Security & Firewall. With Raidboxes, you can also prevent hotlinking via the CORS header in the settings of your box. If you have any questions about the header config of your box, please contact our support team.
"And what about CDN?"
One of the most frequently asked questions is about a content delivery network (CDN). For example: "Will a CDN make my website faster for visitors in Germany?", "Why do I actually need a CDN?", "Would you recommend using a CDN for my blog or store?". In most cases, however, the answer was: No.
To make a long story short: A CDN makes the most sense if your users are geographically dispersed. For example, if you have customers in Central Europe, South America and Australia. If your core target group is limited to one country, you can directly discard a CDN for WordPress optimization.
Incidentally, WordPress developer Ernesto Ruge has written a very nice article on the problem, which I can only recommend to you.
Conclusion: Don't be afraid of seemingly complicated optimization steps
There is often a reluctance to deal with areas where it is particularly easy to save loading time, or they are neglected. Others, however, such as CDN, come up again and again during consultations, although they usually have no effect on the loading time of the website.
Therefore, I can only advise you to focus on the "low hanging fruits" of WordPress performance optimization first. Because with relatively little effort, you can already make great progress in reducing your loading time. Even if you're a layperson.
So don't be put off by the advice of tools such as Google PageSpeed Insights.
At its core, load time optimization is only about a few areas:
- Reduce the size of your website
- Reduction of HTTP requests
- Compression of the individual data packets
- Optimization of the perceived loading time
Once you have understood this, you can also make sensible adjustments to the 10 most important WordPress optimization parameters. And for more complex optimization steps, there are also experts who can bring your website up to scratch.
The loading time will thank you!