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 correct this error, you need to insert the following code into the .htaccess file (located in the root directory of WordPress, you can still 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, then this error will not be fixed completely. But that's okay, because Google Analytics does not slow down your site.

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

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 - "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 "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: 26.02.2019

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

Leave a Reply

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