seo for wordpress sites

How to Fix “Googlebot cannot access CSS and JS files” Error in WordPress

Last modified: June 4, 2026

FAQ
Fiverr freelancers

Do you see the “Googlebot Cannot Access CSS and JS Files” warning in Google Search Console? This error means Google’s crawler is being blocked from loading the stylesheets and scripts that define how your pages look and behave. Without them, Googlebot cannot accurately render your pages, which can hurt rankings. The fix is almost always straightforward: an overly restrictive robots.txt file with a single line blocking your entire wp-content directory. Here is a clear explanation of what is happening and exactly how to resolve it.

# Name Image
1
Why does Google Need Access to CSS and JS Files?
Google Analytics integration
More Info
2
How to Allow Access to your CSS and JS Files to Google
Wordpress Codex
More Info
3
Finding Blocked Resources in Google Search Console
Google Analyticator install
More Info
4
Editing the robots.txt File
add custom code to WP
More Info
Show More

* This button will show the rest of the post and open up an offer from a vendor

Why does Google Need Access to CSS and JS Files?

Google Analytics integration

Google does not just scan your page text. Its crawler renders your pages the same way a browser would. That means Googlebot needs to load your CSS files (which control layout, fonts, and visual design) and JavaScript files (which power interactive elements, dynamic content, and client-side rendering) to understand what users actually see when they visit.

When Googlebot cannot load these files, several problems follow:

  • Your page may appear broken or have a completely different layout than intended
  • Google may not recognize that your site is mobile-friendly, since responsive design is largely controlled by CSS
  • Content rendered via JavaScript, such as product listings, reviews, or dynamic text, may be invisible to Google
  • Google cannot verify that the visual experience matches the text content, which is a signal it uses to detect cloaking and spam

Google has been clear since 2014 that blocking CSS and JS resources works against you. Crawling these files helps Google understand the quality and legitimacy of your site and determines whether the page experience is worth ranking highly. If Googlebot cannot see the page the way users see it, it has less reason to rank it well.

How to Allow Access to your CSS and JS Files to Google

Wordpress Codex

The cause of this error is almost always a Disallow rule in your robots.txt file that is blocking your WordPress content directory. Here is how to find and fix it:

Step 1: Check your robots.txt file

Visit https://yourdomain.com/robots.txt in your browser. Look for any of these lines:

  • Disallow: /wp-content/
  • Disallow: /wp-includes/
  • Disallow: /wp-content/plugins/
  • Disallow: /wp-content/themes/

Any of these will block Googlebot from loading your CSS and JS files. A broad Disallow: /wp-content/ is the most common culprit. It blocks every theme stylesheet, plugin script, and media file on your site in one line.

Step 2: Check WordPress Reading Settings

Go to Settings → Reading in your WordPress admin. If the box that says “Discourage search engines from indexing this site” is checked, WordPress is adding a blanket noindex directive and blocking crawlers from wp-content. Uncheck it and save.

Step 3: Update robots.txt to remove blocking rules

A safe, minimal robots.txt for a WordPress site:

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://yourdomain.com/sitemap_index.xml

No broad content directory blocks. Remove any Disallow lines that reference /wp-content/, /wp-includes/, or specific theme or plugin folders.

If your site uses a CDN: Check whether your CSS and JS files are served from a different subdomain or third-party CDN URL. Your main domain’s robots.txt does not control what Googlebot can access on CDN subdomains. If assets are served from a separate CDN domain, check that domain’s robots.txt separately, or confirm the CDN is not blocking Googlebot via its own access rules. This is a common missed step when the robots.txt fix does not resolve the error.

Finding Blocked Resources in Google Search Console

Google Analyticator install

Google Search Console tells you exactly which files Googlebot cannot access. Here is how to check:

Using the URL Inspection Tool

  1. Log in to your Google Search Console account
  2. Select your property
  3. Paste one of your page URLs into the URL Inspection bar at the top and press Enter
  4. Click Test Live URL to trigger a fresh crawl of the page
  5. Once the test completes, click View Tested Page
  6. Switch to the More Info tab
  7. Scroll to Page Resources. Any file with a red “Not loaded” status or a 403 HTTP error is being blocked.

If you see multiple blocked resources all coming from the same path, for example every file under /wp-content/themes/ shows as blocked, that confirms the problem is a single broad robots.txt rule rather than a per-file server permission issue.

Under Indexing → Pages in Search Console, check the “Why pages aren’t indexed” section. Pages that show “Crawled, currently not indexed” on a site that should be ranking may be suffering from rendering problems caused by blocked resources. The URL Inspection tool gives you the definitive answer per page.

Editing the robots.txt File

add custom code to WP

Once you have confirmed which rules to remove, here are three ways to edit your robots.txt file:

Option 1: Yoast SEO File Editor (recommended)

  1. Install or open Yoast SEO in your WordPress dashboard
  2. Go to Yoast SEO → Tools → File Editor
  3. Find the robots.txt section at the top of the page
  4. Remove any Disallow lines covering /wp-content/, /wp-includes/, or specific plugin or theme directories
  5. Click Save Changes to robots.txt

This is the safest editing method because Yoast validates the file format before saving and you do not need FTP access or command-line tools.

Option 2: FTP/SFTP

  1. Connect to your server using an FTP client (FileZilla is free and widely used)
  2. Navigate to your site’s root directory, the same folder that contains wp-config.php
  3. Download a copy of robots.txt as a backup before changing anything
  4. Open the file in a text editor, remove the offending Disallow lines, and save
  5. Upload the edited file back to the same root directory

Option 3: Hosting Control Panel

Most hosts provide a File Manager in cPanel or Plesk. You can navigate to the root of your domain and edit robots.txt directly in the browser-based editor without any FTP software.

After making changes: Return to Google Search Console and use the URL Inspection tool to run Test Live URL on one of the affected pages. Check the Page Resources tab again. Blocked resources should now show as “Loaded.” The warning in your Coverage report may take a few days to clear as Googlebot recrawls the affected pages. If you want to speed this up, use the Request Indexing button in the URL Inspection tool for your most important pages.

Final Word: How to Fix “Googlebot cannot access CSS and JS files” Error in WordPress

This error almost always traces back to a single overly broad line in your robots.txt file, a Disallow: /wp-content/ rule that was added intentionally or copied from an old configuration. Remove those rules, verify the fix using Google Search Console’s URL Inspection tool, and Googlebot will be able to crawl your CSS and JS files properly.

Rankings typically improve within a few weeks once Google can fully render your pages and compare them accurately against competing results. The fix itself takes minutes; the ranking recovery follows over the next crawl cycle. For most sites, you will see the error disappear from Search Console’s Coverage report within 2 to 4 weeks as Googlebot works through its crawl queue for your domain.

Recap:
Save 4 Later
Email liked links to yourself

    Stay Updated with WordPress Insights

    Get the latest WordPress tips, theme reviews, and industry deals delivered to your inbox.