Estimated Reading Time: 3 min
Eliminating render-blocking resources in WordPress involves optimizing CSS, JavaScript, and fonts to improve page load times. Here’s a step-by-step guide:
1. Use a Caching and Optimization Plugin
The easiest way to address render-blocking resources is by using a plugin:
- Plugins to Try:
- WP Rocket (premium): Automatically optimizes CSS, JavaScript, and other resources.
- Autoptimize: Free and powerful for aggregating, deferring, and minifying assets.
- LiteSpeed Cache: Works well if you use LiteSpeed servers.
- Perfmatters: Lightweight and complements other optimization plugins.
2. Minify and Combine CSS/JS
Minifying removes unnecessary characters (e.g., spaces, comments) to reduce file sizes. Combining reduces the number of requests:
- With Autoptimize:
- Install and activate the plugin.
- Navigate to Settings > Autoptimize.
- Enable these options:
- Optimize JavaScript Code
- Optimize CSS Code
- Aggregate CSS/JS Files
- Save changes and clear cache.
3. Defer or Async JavaScript
Deferring JavaScript ensures scripts load after the page content, while async
loads them in parallel:
- With WP Rocket or Autoptimize:
- Enable the Defer JavaScript option.
- Exclude critical scripts that need to load immediately (e.g., jQuery).
4. Inline Critical CSS
Critical CSS is the minimum CSS required to render the visible part of a page. Inline this CSS and load the rest asynchronously:
- With WP Rocket:
- Enable the Optimize CSS Delivery option.
- With Autoptimize:
- Use the Critical CSS feature or integrate with a tool like CriticalCSS.
5. Remove Unused CSS and JS
Modern tools can detect unused CSS/JS and remove it:
- Plugins:
- Asset Cleanup: Disable unused CSS/JS on specific pages.
- Perfmatters: Selectively disable unused scripts.
6. Use a Content Delivery Network (CDN)
CDNs cache and deliver assets from servers close to users, reducing load times.
- Popular CDNs:
- Cloudflare
- Bunny.net
- KeyCDN
7. Optimize Google Fonts
Google Fonts can be render-blocking. Options to optimize:
- Use a plugin like OMGF to host fonts locally.
- Combine and preload fonts for faster loading.
8. Preload Critical Resources
Preloading tells the browser to load critical resources earlier:
- Add preload tags for CSS/JS/fonts in your theme’s
<head>
:<link rel="preload" href="style.css" as="style"> <link rel="preload" href="script.js" as="script">
9. Lazy Load Images and Videos
Lazy loading defers loading of non-visible images/videos:
- Use a plugin like:
- WP Rocket (built-in lazy loading).
- Lazy Load by WP Rocket.
10. Test and Monitor Performance
- Use tools like:
By combining these strategies, you can significantly reduce render-blocking resources and improve your site’s performance.
Discover more from Be-smart
Subscribe to get the latest posts sent to your email.