WordPress website optimization for Google PageSpeed

page-speedSite loading speed is one of the search engine ranking factors.

You can check how fast your website is using Google PageSpeed Insights.

Good download speed - if the site is in the green zone.

How to improve the performance of site loading in Google PageSpeed

Error "Defer offscreen images"

Google recommends using the lazy loading principle for hidden images after all important resources are loaded. Install the Lazy Load Optomizer plugin, which adds a lazy load image for Thumbnails and standard WordPress galleries, as well as images of products and WooCommerce product categories.

Error - "Serve static assets with an efficient cache policy"

To fix this error, you need to insert the following code in the .htaccess file (located in the root directory of WordPress, you can also access it using the Yoast SEO plugin):

<IfModule mod_expires.c>
ExpiresActive On 
ExpiresDefault "access plus 6 month"
ExpiresByType text/css "access plus 6 month" 
ExpiresByType text/plain "access plus 6 month"
ExpiresByType image/gif "access plus 6 month"
ExpiresByType image/png "access plus 6 month" 
ExpiresByType image/jpeg "access plus 6 month" 
ExpiresByType application/x-javascript "access plus 6 month"
ExpiresByType application/javascript "access plus 6 month"
ExpiresByType application/x-icon "access plus 6 month" 


If you use Google Analytics, you won't be able to fix this error. But that's okay, because this service does not slow down your site.

Errors - "Eliminate render-blocking resources", "Defer unused CSS", "Minify CSS", "Minify JavaScript"

These errors will help fix the plugin Autoptimize. In the settings include:

  • Optimize HTML code
  • Optimize javascript code
  • Optimize CSS code

Check the setting "Inline all CSS".

Also, this problem may occur if the site uses Google fonts. Click on the "Advanced" tab of this plugin. There you need to set the setting for Google fonts - Combine and preload in head (fonts load late, but not are render-blocking).


Error - "Preload key requests"

Autoptimize will help you solve this problem again. In the "Advanced" tab, you need to find The preload specific request item.

preload specific request


Here you need to insert the full url of the resource. If there are several of them, then insert several, separated by a comma. You can copy the resource url by right-clicking on the resource link:

preload key request

Error - "Efficiently encode images"

To optimize images, install the WP Smush plugin. This plugin optimizes all images uploaded to the WordPress Media Library. If there are images downloaded from the theme directory, they will have to be optimized manually.

A good site where you can optimize pictures online - https://tinypng.com/

Error - "Serve images in next-gen formats"

The WebP Converter for Media plugin will fix this error . This plugin will create analogs for all images on the site in the new WebP format. On browsers that support this format, images will be loaded in the new format, while other browsers will load the old png or jpg format.

Error "Reduce server response times (TTFB)"

Most often with it helps to fight plugin WP Super Cashe. After installation, you need to enable caching in the plugin settings and enable the option - "Compress pages so they’re served more quickly to visitors. (Recommended)":

If this does not help, it is worth thinking about changing the hosting to a better one.

Error "Enable text compression"

Add to the .htaccess file:

<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript


A snippet that will add asynchronous loading for scripts connected via wp_enqueue_script ():

add_filter('script_loader_tag', 'add_async_attribute', 10, 2);

function add_async_attribute($tag, $handle)
        if ('jquery-core' == $handle) {
            return $tag;
        return str_replace(' src', ' defer src', $tag);
        return $tag;

Updated: 06.11.2020

Did this article help you? Rate it!
(6 votes, average: 4.50 out of 5)

Leave a Reply

Your email address will not be published. Required fields are marked *


Send message