Back to Community

Understanding and Fixing Render-Blocking and Unused Code Warnings from Speed Optimizer

Content

If you use the 'Speed Optimizer – The All-In-One Performance-Boosting Plugin' and run performance tests with tools like Google PageSpeed Insights or GTmetrix, you've likely encountered warnings about render-blocking resources or unused JavaScript and CSS. These warnings often point to files with names like siteground-optimizer-combined-css-XXXXX.css and siteground-optimizer-combined-js-XXXXX.js.

This is a common point of confusion, but it's usually not a bug in the plugin. Let's break down why these warnings appear and what you can do about them.

Why Do These Warnings Appear?

The primary function of the file combination feature in Speed Optimizer is to improve site performance by reducing the number of HTTP requests a page makes. It does this by taking all the individual CSS or JavaScript files needed for a page and merging them into one combined file.

Performance audit tools then analyze this single, large file and often report two things:

  1. Render-Blocking Resources: By definition, CSS is a render-blocking resource. The browser must load and process it to display the page correctly. Combining CSS files doesn't change this fundamental behavior; it just bundles it all into one request.
  2. Unused JavaScript/CSS: A combined file contains every script and style needed across your entire website. On any single page, it's likely that not every line of code in that massive file is used. The auditing tools detect this unused code and flag it.

As stated in the plugin's support threads, "The plugin does not have a way to determine the importance of the JS and CSS files on your site pages." The combined files are a reflection of your site's themes and plugins. If your theme loads 500KB of CSS and a slider plugin loads 200KB of JS on every page, the combined file will be large and contain code that isn't used on every page.

Common Solutions and Best Practices

Chasing a perfect score is often counterproductive. The goal is a fast, good user experience, not a green checkmark on every audit item. However, if these warnings are significantly impacting your performance, here are the most effective ways to address them.

1. Tweak Speed Optimizer's Settings

  • Exclude Non-Critical Files: Speed Optimizer provides fields to exclude specific CSS or JavaScript files from combination. If you know a particular plugin's file is large and only used on one page (e.g., a contact form plugin on the 'Contact' page), you can exclude it. This prevents its code from being added to the combined file on every other page, reducing its size.
  • Test with Combination Turned Off: Test your site's speed with the 'Combine CSS Files' and 'Combine JavaScript Files' options both ON and OFF. Sometimes, the overhead of processing one very large file is worse than the benefit of reducing multiple requests. Choose the configuration that provides the best actual load time and user experience for your visitors.

2. Optimize Your Site's Code at the Source

Since the combined files are built from your site's assets, the best long-term solution is to reduce bloat at the source.

  • Use a Well-Optimized Theme: Some themes are notorious for loading excessive amounts of CSS and JavaScript. Consider using a lean, performance-focused theme.
  • Audit Your Plugins: Every plugin adds its own code. Deactivate unused plugins and seek alternatives for ones that are particularly heavy.
  • Implement Code Splitting: For advanced users, techniques like loading certain CSS/JS only on the pages where they are needed can dramatically reduce the size of the combined files. This often requires custom development work.

3. Clean Up After Migration or Uninstallation

If you have moved your site away from a host that supports Speed Optimizer or have uninstalled the plugin, you may find the combined asset files are still being reported.

This happens because the wp-content/uploads/siteground-optimizer-assets/ folder and its files were not deleted. To fix this:

  1. Use your hosting file manager, FTP, or SSH to access your site's root directory.
  2. Navigate to wp-content/uploads/.
  3. Locate and delete the entire siteground-optimizer-assets folder.
  4. Clear all caching layers (server, plugin, CDN) after deletion.

When It Might Be a Different Issue

In some cases, these files can be involved in other problems:

  • 404 Errors: If tools report broken links to these files, it's often a caching conflict. Try disabling other caching plugins to resolve the issue.
  • Malware False Positives: Since these files combine all your scripts, if one script was malicious, the combined file would contain that code. A malware warning on these files indicates you need to scan the rest of your site for infected code.

In summary, warnings about render-blocking and unused code from Speed Optimizer's combined files are typically a side effect of its core function, not a malfunction. The solution involves a balance of plugin configuration and broader website optimization focused on reducing unnecessary code.

Related Support Threads Support