Have you ever finished creating a WordPress website and loved everything about it? Then, promptly began to hate it after realizing it takes forever to load?
Not only are slow loading speeds a nuisance for you and your visitors, but they can also cost you significantly when it comes to SEO. Since 2010, Google algorithms have accounted for loading speed in ranking decisions, so slow pages appear lower on results pages.
You might be familiar with the common culprits of poor page performance — excessive content, uncompressed image files, insufficient hosting, and lack of caching to name a few. But, there’s another often-overlooked perpetrator in play: render-blocking resources.
What are render-blocking resources?
If you’ve optimized your page performance in WordPress and are still experiencing problems, render-blocking resources may be the culprit. Sometimes this code is important to run on the first load, but much of the time it can be removed or pushed until the very end of the queue.
In this post, we’ll show you how to eliminate this pesky code from your WordPress website and give your performance a boost.
If you'd rather follow along with a video, check out this walkthrough created by WP Casts:
How to Eliminate Render-Blocking Resources in WordPress
Identify the render-blocking resources.
Eliminate the render-blocking resources manually or with a plugin.
Re-run a site scan.
Check your website for bugs.
1. Identify the render-blocking resources.
Before making any changes, you first need to locate the render-blocking resources. The best way to do this is with a free online speed test like Google's PageSpeed Insights tool. Paste in your site’s URL and click Analyze.
When the scan is complete, Google assigns your website an aggregate speed score, from 0 (slowest) to 100 (fastest). A score in the 50 to 80 range is average, so you’ll want to land in the upper part of this range or above it.
To identify render-blocking files that are slowing your page, scroll down to Opportunities, then open the Eliminate render-blocking resources accordion.
You’ll see a list of files slowing the “first paint” of your page — these files affect the loading time of all content that appears in the browser window on the initial page load. This is also called “above-the-fold” content.
Take note of any files ending with the extensions .css and .js, as these are the ones you’ll want to focus on.
2. Eliminate the render-blocking resources manually or with a plugin.
Now that you’ve identified the issue, there are two ways to go about fixing it in WordPress: manually, or with a plugin. We’ll cover the plugin solution first.
Several WordPress plugins can reduce the effect of render-blocking resources on WordPress websites. I’ll be covering two popular solutions, Autoptimize and W3 Total Cache.
How To Eliminate Render-Blocking Resources With the Autoptimize Plugin
Autoptimize is a free plugin that modifies your website files to deliver faster pages. Autoptimize works by aggregating files, minifying code (i.e., reducing file size by deleting redundant or unnecessary characters), and delaying the loading of render-blocking resources.
Since you’re modifying the backend of your site, remember to use caution with this plugin or any similar plugin. To eliminate render-blocking resources with Autoptimize:
2. From your WordPress dashboard, select, Settings > Autoptimize.
4. If the box next to Aggregate JS-files? is checked, uncheck it.
5. Under CSS Options, check the box next to Optimize CSS Code?.
6. If the box next to Aggregate CSS-files? is checked, uncheck it.
7. At the bottom of the page, click Save Changes and Empty Cache.
8. Scan your website with PageSpeed Insights and check for an improvement.
How To Eliminate Render-Blocking Resources With the W3 Total Cache Plugin
1. Install and activate the W3 Total Cache plugin.
2. A new Performance option will be added to your WordPress dashboard menu. Select Performance > General Settings.
3. In the Minify section, check the box next to Minify, then set Minify mode to Manual.
4. Click Save all settings at the bottom of the Minify section.
5. In the dashboard menu, select Performance > Minify.
6. In the JS section next to JS minify settings, make sure the Enable box is checked. Then, under Operations in areas, open the first Embed type dropdown and choose Non-blocking using “defer”.
7. Under JS file management, choose your active theme from the Theme dropdown.
10. In the CSS section next to CSS minify settings, check the box next to CSS minify settings and make sure the Minify method is set to Combine & Minify.
11. Under CSS file management, choose your active theme from the Theme dropdown.
12. For each item under Eliminate render-blocking resources ending in .css in your PageSpeed Insights scan results, click Add a style sheet. Then, copy the full URL of the CSS resource from PageSpeed Insights and paste it into the File URI field.
13. Once you’ve pasted in all render-blocking CSS resources reported by PageSpeed Insights, click Save Settings & Purge Caches at the bottom of the CSS section.
14. Scan your website with PageSpeed Insights and check for an improvement.
To do this, locate the <script> tags in your website files for the resources identified in your PageSpeed Insights scan. They will look something like this:
<script> tags tell the browser to load and execute the script identified by the src (source) attribute. The problem with this process is that this loading and executing delays the browser’s parsing of the web page, which impacts the overall load time:
While they have similar effects on load times, these attributes tell the browser to do different things.
Scripts with the defer attribute are also loaded while the page is parsed, but these scripts are delayed from loading until after the first render or until after the more essential portions have loaded:
The defer and async attributes should not be used together on the same resource, but one may be better suited for a particular resource than the other. Generally, if a non-essential script relies on a script to run before it, use defer. The defer attribute ensures that the script will run after the preceding necessary script. Otherwise, use async.
3. Re-run a site scan.
After making your changes, conduct one final scan of your website through PageSpeed Insights and see what impact your changes had on your score.
Hopefully, there’s a noticeable improvement, but don’t worry if not. Many factors can inhibit page performance, and you may have to do some more digging to find the source of poor performance.
4. Check your website for bugs.
In addition to a rescan, check your pages to make sure your site works. Does the page load correctly? Are all elements showing up? If something is broken or fails to load properly, undo your changes and troubleshoot the issue.
If you’ve reached a point where you’ve repeatedly tried various measures with minimal speed gains, it might be best to consider other ways to speed up your pages, rather than risk breaking your site.
Optimizing Your WordPress Site for Performance
Many factors contribute to your users’ experience on your website, but few are more important than load time. Whenever you make big changes to content or appearance on your WordPress site, you should always consider how such changes affect performance.
Now that you’ve eliminated the render-blocking resources, you should continue to optimize your website’s speed by analyzing other features that are known to slow down performance. Try to incorporate regular speed testing into your site maintenance schedule — staying ahead of any potential issues will be critical to your success.
Originally published Jan 11, 2021 7:00:00 AM, updated September 30 2021