If you’ve ever run your WordPress site through Google PageSpeed Insights, Google has probably told you that you need to eliminate render-blocking resources on your WordPress site. In fact, that might be why you’re reading this very post right now.

That probably poses two questions in your mind:

  1. What are render-blocking resources in the first place?
  2. How can you eliminate render-blocking resources on WordPress?

In this post, we’re going to answer both questions for you. Here’s everything that we’ll cover in this post:

Prefer to watch the video version?

What Does “Eliminate Render-Blocking Resources” Mean?

In order to understand what render-blocking resources are and why they hurt your site’s load times, we need to start with a basic look at how a web browser renders a web page.

When a visitor lands on your site, their web browser basically starts at the top of your site’s code and reads down. Top-to-bottom, got it?

If in that process, it encounters a CSS or JavaScript file, it needs to stop “reading” while it waits to download and process that file. The time that it spends “paused” to download and parse those resources could be spent on something much more productive, like loading the part of your website’s content that’s immediately visible when someone lands on the page.

Let’s look at an extreme example to show why this can be an issue.

Let’s say that you have this cool JavaScript effect in your site’s footer. It’s powered by “coolfooter.js”, which is a script that’s referenced at the top of your site’s code (even though the effect is in the footer, so visitors won’t see it until they scroll to the footer).

So a very rough layout for your site’s code might be something like:

  • Header meta
  • Coolfooter.js
  • HTML for your above-the-fold content. This is all the content that a visitor sees right away (before they start interacting with the page)

And here’s why this is a problem:

When a visitor lands on your site, their browser starts reading from top-to-bottom. So before it can parse and render the HTML for the above-the-fold content on your site, it needs to wait to download and parse the coolfooter.js file.

End result? It takes longer to display the HTML for the above-the-fold content, which means that your visitors will perceive your site as being slower.

When Google tells you to eliminate render-blocking resources, it’s essentially saying, “hey, don’t load unnecessary resources at the top of your site’s code because it’s going to make it take longer for visitors’ browsers to download the visible part of your content”.

With the tips in this post, you’ll be able to wait to load certain CSS and JavaScript resources until the visible part of your page has already loaded.

What are Render-Blocking Resources?

When referring to render-blocking resources, we’re usually talking about:

  • CSS
  • JavaScript

It’s important to understand that not all CSS and JavaScript files are render-blocking.

For example, it’s important to load your critical CSS near the top, otherwise your visitors might experience what’s known as a flash of unstyled content (FOUC).

Are Images Render-Blocking Resources?

No, images are not render-blocking. It’s still important to optimize your images to reduce their file sizes, but you do not need to worry about optimizing the delivery path for your images.

How to Test If Your Website Has Render-Blocking Resources

To assess whether or not your WordPress site currently has render-blocking resources, you can use Google PageSpeed Insights.

All you do is enter the URL that you want to test. Then, if you have a problem with render-blocking resources, PageSpeed Insights will list each individual resource in the Eliminate render-blocking resources section under Opportunities:

The Eliminate Render-Blocking Resources message in PageSpeed Insights
The Eliminate Render-Blocking Resources message in PageSpeed Insights

How Do You Eliminate Render-Blocking Resources?

Don’t worry, you don’t have to do this manually. We’ll talk about WordPress plugins that can help you eliminate render-blocking resources in the next section.

However, it is helpful to understand what these plugins are doing behind the scenes to eliminate render-blocking resources.

How to Eliminate Render-Blocking JavaScript

There a few different strategies to eliminate render-blocking JavaScript. We cover these in detail in our article on how to defer parsing JavaScript, but here are the main methods:

  • Async – lets the HTML parser (e.g. a visitor’s browser) download the JavaScript while still parsing the rest of the HTML. That is, it doesn’t completely stop parsing while the file downloads. However, it will pause the HTML parser to execute the script once it downloads.
  • Defer – lets the HTML parser download the JavaScript while parsing the rest of the HTML and waits to execute the script until the HTML parsing is finished.

This illustration from Growing with the Web does a great job of showing the difference:

JavaScript async vs defer
JavaScript async vs defer

The benefit of using defer is that your scripts are guaranteed to execute in the order that they appear in the code.

Async does not use this approach, which can sometimes cause issues if you apply async to all JavaScript resources because it can often break resources that are dependent on resources that appear earlier in the document. The most common problem async produces is broken jQuery resources that try to load before jquery.js has been added to the document.

How to Eliminate Render-Blocking CSS

Eliminating render-blocking CSS can be a little trickier because you have to be careful not to delay CSS that is needed to render above-the-fold content. The ideal arrangement is to:

  • Identify the styles that are required to render above-the-fold content and deliver those styles inline with the HTML.
  • Use the media attribute on the link elements that pull in CSS files to identify CSS resources that are conditional, that is, only needed for specific devices or situations.
  • Remaining CSS resources should be loaded asynchronously, a move that is typically done by adding them with deferred or asynchronous JavaScript.To be honest, we’re really getting in over our heads here, aren’t we? This is definitely frontend engineer territory. Which is great if you’re are a front-end engineer, but most of us aren’t. The good news is that this is an article about WordPress, and you can eliminate or at least significantly reduce the number of render-blocking JS and CSS resources affecting your site with the right plugin(s).

For another quick and easy way to boost your overall optimization, consider also minifying your code. Kinsta has built a code minification feature right into the MyKinsta dashboard, allowing customers to enable automatic CSS and JavaScript minification with a simple click.

If you are not able to locate the feature in your dashboard, simply check out our How to Enable Minification in MyKinsta video.

How to Eliminate Render-Blocking CSS and JavaScript Resources with WordPress Plugins

To demonstrate how to eliminate render-blocking resources on WordPress, we’ve set up a simple test site that includes render-blocking CSS and JavaScript and then we’ll take you through how to use two different plugin solutions to eliminate the render-blocking CSS and JavaScript:

  • Autoptimize + Async JavaScript (free)
  • WP Rocket (paid)

For reference, here’s what our test site looks like before optimizing CSS and JavaScript delivery:

The Eliminate Render-Blocking Resources message in PageSpeed Insights
The Eliminate Render-Blocking Resources message in PageSpeed Insights

If you’re testing the effectiveness of your changes with Google PageSpeed Insights, be aware that Google caches its results for several minutes. Essentially, this means that if you quickly…

  1. Test your unoptimized site
  2. Activate one of the plugins in this section
  3. Retest your site

…then you’ll still see the results for your unoptimized site until Google resets its cache. So make sure you wait a few minutes for Google to clear its cache before you think that the plugin isn’t working.

How to Eliminate Render-Blocking Resources with Autoptimize + Async JavaScript Plugin

Autoptimize and Async JavaScript are two separate free plugins from the same developer. Together, they help you optimize the delivery of both your CSS and JavaScript.

Once you’ve installed both plugins, go to Settings → Async JavaScript and:

  • Check the box to Enable Async JavaScript at the top.
  • Choose between Apply Async and Apply Defer in the Quick Settings box.
How to configure Async JavaScript plugin
How to configure Async JavaScript plugin

If the Async option causes problems on your site, we’d recommend trying Defer or excluding jQuery, which the plugin gives you an option for.

Once you’ve set up the Async JavaScript plugin, go to Settings → Autoptimize and:

  • Check the box to Optimize JavaScript Code
  • Check the box to Optimize CSS Code
How to configure Autoptimize plugin
How to configure Autoptimize plugin

If you’re an advanced user, you can play around with the additional JavaScript and CSS optimization settings, but most sites will be fine with the defaults.

After configuring Autoptimize and Async JavaScript, our test site passed PageSpeed Insights’ “Eliminate render-blocking resources” audit:

PageSpeed Insights results w/ Autoptimize and Async JavaScript
PageSpeed Insights results w/ Autoptimize and Async JavaScript

If you wanted to eliminate even more of those files, you could further use Autoptimize to manually inline your critical CSS. This requires some development knowledge, though, so it’s not something non-developers should try.

You can also use the plugins separately if preferred. But given that both plugins come from the same developer and are built to play nice with each other, the best approach for most sites is to combine them.

How to Eliminate Render-Blocking Resources with WP Rocket

WP Rocket is a popular premium WordPress performance and caching plugin.

Normally, we don’t allow caching plugins on WordPress sites hosted at Kinsta because we already handle caching for you at a server level via the speedy Nginx FastCGI cache.

However, WP Rocket has a special integration with Kinsta that lets WP Rocket play nice with your Kinsta caching. That’s great because WP Rocket does a lot more for WordPress performance than just caching, including helping you eliminate render-blocking CSS and JavaScript resources on your WordPress site.

Once you install and activate WP Rocket, go to the File Optimization tab. Then, enable these two options:

  • Optimize CSS delivery under the CSS Files section
  • Load JavaScript deferred under the JavaScript files section. You can experiment with turning the Safe Mode for jQuery off. But if you notice problems on the front-end of your site, you’ll want to re-enable safe mode for jQuery as it’s the likely culprit.
Wp Rocket backend
How to configure WP Rocket

After activating these two features, our test site also passed the “eliminate render-blocking resources” audit in PageSpeed Insights. WP Rocket also managed to eliminate more render-blocking resources than the Autoptimize/Async JavaScript setup:

PageSpeed Insights results w/ WP Rocket
PageSpeed Insights results w/ WP Rocket

And that’s how to eliminate render-blocking resources on your WordPress website!

Summary

Render-blocking resources slow down the perceived page load times of your WordPress site by forcing visitors’ browsers to delay rendering above-the-fold content while the browser downloads files that aren’t needed right away.

To help visitors load the visible portion of your page more quickly, you should delay loading resources that aren’t immediately required.

To eliminate render-blocking resources on WordPress, you can use off-the-rack plugins.

For a free solution, you can use the combination of Autoptimize and Async JavaScript, two plugins from the same developer.

If you’re willing to pay, you can use WP Rocket, which offers a special integration with Kinsta and can help with lots of other WordPress performance tweaks.

Do you have any additional questions about how to eliminate render-blocking resources on WordPress? Let us know in the comments!

Jon Penland

Jon is the Chief Operating Officer at Kinsta and is involved with Kinsta's sales, customer service, and technical support teams on a daily basis. Jon's a family man. So when he isn't feverishly tapping the keys of his laptop he's usually helping one of his kids fix a bike or setting up Netflix for an impatient preschooler.