To get your website to good positions in search results, many aspects of the site have to work well together. Informative texts with suitable keywords and high-quality links pointing to your site are especially important. With the ever-growing share of smartphones and tablets used for browsing (at the time of this post, a good 45% of all internet users), the speed of individual pages is becoming more important for search engines like Google as well. Google does not state directly how strongly the speed of a website affects its position in search results, but it is definitely a ranking factor. One indication is, for example, Google’s PageSpeed Insights tool, which was heavily overhauled recently. With this helpful tool you can test your own website and get suggestions for improvement as well. The goal is to make websites faster and leaner at the same time. This lets users with a slow internet connection or a low-powered device jump from page to page quickly anyway.
In this post, we take on a blog that has since been archived and raise its PageSpeed score. The blog is based on WordPress and a custom-developed theme. For the optimization, we use freely available plugins and tools, and we also discuss Google’s own recommendations.
Starting Point

With 62 points, our blog has a score in the lower middle range. So there is plenty of room for improvement, and most likely it can be applied to your blog or website as well.
The first item among Google’s suggested recommendations is to eliminate resources that block or slow down rendering. This refers to stylesheets and JavaScript files that the browser has to download and interpret on every visit. The more files the browser has to retrieve and interpret, the longer it takes until the actual website appears on the user’s screen. An optimal solution here would be to combine all required .CSS and .JS files. WordPress plugins that are used in the frontend of the site have the unpleasant habit of loading their own CSS and JavaScript files. In theory, every installed plugin can slow us down.
A handy plugin for combining JS and CSS files is the free WordPress plugin W3 Total Cache. This caching plugin takes care of several tasks at once that will make our lives noticeably easier.
W3 Total Cache Settings
General Settings
After installing W3 Total Cache, a new tab appears in the admin panel where you can make the basic settings for W3 Total Cache. The caching plugin does not start working automatically after installation. The individual features have to be activated and tested by hand first. Many of the options we go through in this post can cause problems on your website or blog. After activating each option, it is a good idea to test your website to find out whether everything still works as intended.
Page Cache

WordPress creates content anew on every page visit. For every visitor, database queries are sent, for example, to display the information of the requested page. These requests delay page rendering and can quickly lead to bigger problems such as an overloaded database on high-traffic sites. With the Page Cache feature, static versions of the pages are stored and can then be served directly. The available cache methods depend on the features installed on the server. Installations on regular web hosting can in most cases be set to Disk: Enhanced without concern.
Minify

The Minify feature is a very effective way to reduce the size of CSS, HTML, and JavaScript code. CSS code that is loaded split across 4 different files, for example, can be combined into a single file automatically after activation. Four requests to the server become a single one. Unfortunately, this setting often cannot be activated without problems. Especially with several included JavaScript files, compressing and combining them can cause trouble. After activating Minify, you should test all functions of your site. The developer console of your browser can also quickly tell you whether any JavaScript errors occur after the change. Tip: if you have already activated the Page Cache, you have to delete the currently generated cache after every change using the option Performance -> Purge all Caches in the admin bar.
If problems occur after switching to Minify, you can try to make further settings under the menu item Minify. Under JS, you can then define how Minify handles JavaScript files. Among the options is, for example, Operations in areas. Here you can specify how JavaScript files should be included. Make sure that JS code marked with “async”, for example, is not executed at the moment the page is visited. With cookie banners, for example, this means they are no longer displayed. If you run into problems, you can try switching to Combine only. If you use plugins that cause problems after the change, you can look for alternatives that may cope better with the compression. In my experience, problems occur especially with older plugins that have not been updated for some time. If these settings do not lead to the desired result, the last resort is unfortunately to disable JavaScript compression. In my case, the compression is compatible, so I got lucky.
If Minify worked, you can take a look at the source code of the page next. The nicely nested code should have turned into an unreadable stream of HTML. This code is not nice to look at for the human eye, and certainly not clear, but it is no problem for browsers. The saved lines lead to smaller file sizes and faster load times. JavaScript and CSS code have now also been combined into matching files.

Object Cache and Database Cache

For simple blogs, speed should already have increased noticeably through page caching and the changes from Minify. If your WordPress blog also contains database-intensive applications, using the Database Cache feature is recommended. It stores the results of database queries and can then deliver them faster. In addition to the Database Cache, there is also the option to keep the Object Cache implemented in WordPress for a longer time. By default, the cache used by WordPress is rebuilt on every page load. The lifetime of this cache ends when the website has been delivered. The data in the cache is then deleted. W3 Total Cache offers the option to keep this cache longer, which can make recurring script executions noticeably faster and relieves the database further.
Browser Cache

Browser caching is another important tool for optimizing the load time of a WordPress blog. With this feature, content such as JavaScript, CSS, or images is marked with an expiration date. This expiration date tells the visitor’s browser that the marked files do not change regularly and can be stored temporarily. As an example, a visitor comes to a website and loads the stylesheet, JavaScript, the logo, and the HTML code used to display the content. Our site states that the stylesheet, JavaScript, and logo are valid for 30 days. If the visitor then jumps to another subpage, their browser does not request the stylesheet, the already loaded JavaScript code, or the logo from the server again, but accesses them directly from its own cache. The required data does not have to be downloaded again, which saves time and resources.
For browser caching, you will find further options under Browser Cache in the left menu. Under the advanced options, it is a good idea to send an “Expire Header” for the respective file types. This can help convince the visitor’s browser to actually store the marked files in its local cache. To do this, activate the option Set expires header.

If you run into problems with W3 Total Cache, the settings for browser caching can also be made directly in your .htaccess file. To do so, you can insert the following code at the beginning of the file.
# BROWSER CACHING #
ExpiresActive On
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/xhtml-xml "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresDefault "access 1 month"
# BROWSER CACHING #
Gzip / Deflate Compression

The browser cache settings also contain another important function for compressing text-based content. If the option Enable HTTP(gzip) compression is activated, the server transmits a compressed version of the content, which the browser then unpacks and displays. You can think of this process like a classic .zip file. It reduces the amount of transferred data and thus enables faster loading, especially on mobile devices with slow internet connections. Images are deliberately not transferred compressed, because common formats such as JPG or PNG are already compressed. Additional compression only puts unnecessary load on server capacity and offers no benefit.
If gzip compression does not work through W3 Total Cache, the matching settings can also be written directly into the .htaccess file. The following code is intended for use on Apache servers. If you use a web hosting package, this applies to you in most cases as well.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/atom+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-web-app-manifest+json
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/x-component
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/javascript
</IfModule>
Interim Analysis: Noticeably Improved
With W3 Total Cache, we were able to make a broad range of performance improvements. Let us take a quick look at our PageSpeed Insights score.

Our optimizations earned us 24 points, and the load times of the page should already be noticeably faster. We have not quite reached our goal yet, though. There are still a few optimizations, some of which can be implemented fairly quickly.
Lazy Loading
When a visitor finds their way to our website, all content is loaded by default when the page is opened. That includes, for example, images further down the page that are not in the viewer’s field of view. With lazy loading, images that are not essential at first are loaded only shortly before they become visible. This makes page rendering noticeably faster, especially on mobile devices with a slow internet connection. If you care about a spotless W3C validation, you should skip this solution. With lazy loading, images are by default given their own CSS class and lose their “src” attribute, which can cause problems when validating the page. From a search engine optimization standpoint, however, the improved load times weigh significantly more than the underlying code.
For WordPress there are various ready-made plugins that add lazy loading to your blog. I chose BJ Lazy Load. In the settings, you can define which media should be handled by lazy loading. You can also choose to show a placeholder image until the respective resource has finished loading. This small change gives us an even better load time, and Google’s PageSpeed Insights now rates us with the following score.
Interim Analysis: Almost There

A pretty good score, not perfect but still impressive. To get even more points, we have to look at Google’s remaining recommendations.

Properly Size Images
This item shows images that are displayed scaled on the website. For example, it might point out an image with dimensions of 500×500 that is displayed at 250×250 on the website. If you see messages like this, it helps to adjust the size of the thumbnails used. To do this, you have to adjust the thumbnail sizes used by your theme, for example. The options required for this are found in different places depending on the theme. In most cases, the thumbnail settings are located directly in the functions.php file. It is best to search for the function add_image_size. You can find more information on how to use this function in the official WordPress Code Reference.
Eliminate Render-Blocking Resources
Opinions differ on this suggestion. Among other things, Google recommends deferring unused CSS code, or loading it only when it is actually needed on the page. The CSS code that is most important for the page, such as font information, background colors, and other basic style information, should be built directly into the source code. Important JavaScript code should also be moved directly into the source code. JavaScript code that is not required for the actual display of the content can be deferred, for example with the “defer” attribute. JavaScript included with defer is only executed once the website has been loaded completely and interpreted by the browser. Alternatively, the JavaScript code can be moved from the header to the footer area of the website, so it no longer blocks the page load.
If you use several plugins that provide frontend functionality, this type of optimization can be hard to carry out. Many JavaScript functions built into various ready-made themes have to be executed as soon as the website is opened. If you change the point at which JavaScript is loaded, you can end up with display errors or completely missing functions. Implementing the requirements for stylesheets can also be problematic. If the CSS code needed to display the website is loaded too late, display problems can occur. Google recommends placing important CSS code directly in the source code of the page. This means, for example, CSS code that describes the general structure of your page, such as the dimensions of the most important div containers, the chosen font, or the colors to be used.
With Minify, we combined these files earlier and thereby already saved load time. Most plugins do not offer the option to output CSS code inline on the website, and until recently this practice was even prohibited for plugins offered on ThemeForest, for example. This makes implementing this requirement much harder still. This brings us to the question of whether optimizing the stylesheet information really makes sense. Our page does load a few milliseconds faster after the change, but we may have to accept display errors in return. Google’s suggestion to defer unused CSS code is also questionable. It means that we adjust the stylesheet on every page so that it really only describes the elements that are actually visible. That does save traffic, but when visiting further subpages the visitor’s browser cannot fall back on the already cached version of the stylesheet, because it differs from the previous page. The first visit would be a few milliseconds faster, but every further subpage would be a few milliseconds slower.
In many cases, it is not possible to resolve these problems without considerable effort. It is also more than questionable whether this optimization is worth the effort. The time consumed here would almost certainly be better invested in the search for new backlinks.
For those of you who still want to tackle this option, here are a few approaches.
Moving Scripts to the Footer with W3 Total Cache
To quickly move scripts to the footer when using W3 Total Cache, you have to edit the footer.php of your theme. One line before






