Family Encyclopedia >> Electronics

How to fix error Googlebot cannot access CSS and JS files in WordPress

Are you seeing 'Googlebot cannot access CSS and JS files' warning in Google webmaster tools account for your WordPress site? The message contains links to instructions on how to fix this problem, but those instructions are not very easy to follow. In this article, we will show you how to fix “Googlebot cannot access CSS and JS files” error on your WordPress site.

How to fix error Googlebot cannot access CSS and JS files in WordPress

Why does Google need access to CSS and JS files?

Google focuses on providing better rankings for user-friendly websites:sites that are fast, have a good user experience, etc. To determine the user experience of a website, Google needs access to be able to visit the site's CSS and JavaScript files.

By default WordPress does not block search bots access any CSS or JS file. However, some site owners may accidentally block their sites while trying to add additional security measures or using a WordPress security plugin.

This restricts Googlebot from indexing CSS and JS files that can affect the SEO performance of your site.

That said, let's see how we can locate these files and unlock them.

How to give Google access to your CSS and JS files

You first need to know which files Google cannot access on your website.

You can see how Googlebot sees your website by clicking Crawl »Fetch as Google in Google Search Console (formerly Webmaster Tools). Next, click the "find and render" button (you want to do this for both desktop and mobile).

How to fix error Googlebot cannot access CSS and JS files in WordPress

Once retrieved, the result will appear in a row below. Clicking it will display what a user sees and what Googlebot sees when it loads your site.

How to fix error Googlebot cannot access CSS and JS files in WordPress

If you see any difference between the two screenshots, this means that Googlebot was unable to access the CSS/JS files. It will also show you the links of the CSS and JS files that you were unable to access.

You can also find a list of these blocked resources at Google Index »Blocked Resources .

How to fix error Googlebot cannot access CSS and JS files in WordPress

Clicking on each resource will display links to actual resources that Googlebot cannot access.

Most of the time, these are CSS styles and JS files added by your WordPress plugins or themes.

Now you'll need to edit your site's robots.txt file, which is what controls what the Google bot sees.

You can edit it by connecting to your site using an FTP client. The robots.txt file will be in the root directory of your site.

How to fix error Googlebot cannot access CSS and JS files in WordPress

If you are using the Yoast SEO plugin, then you can edit the robots.txt file from your WordPress admin area. Simply go to SEO »Tools page and then click File Editor .

How to fix error Googlebot cannot access CSS and JS files in WordPress

You will most likely see that your site has not allowed access to some WordPress directories like this:

Agente de usuario: *
No permitir: / wp-admin /
No permitir: / wp-includes /
No permitir: / wp-content / plugins /
No permitir: / wp-content / themes /

Now you need to remove the lines that are blocking Google from accessing the CSS or JS files on the front-end of your site. Typically, these files are located in the plugin or theme folders. You may also need to remove wp-includes, many WordPress themes and plugins can call scripts located in the wp-includes folder, such as jQuery.

Some users may notice that their robots.txt file is empty or even non-existent. If Googlebot doesn't find a robots.txt file, then it automatically crawls and indexes all files.

So why are you seeing this warning?

On rare occasions, some WordPress hosting providers may proactively block access to default WordPress folders for bots. You can override this in robots.txt by allowing access to locked folders.

Agente de usuario: *
Permitir: / wp-includes / js /

Once you're done, save your robots.txt file. Visit the Google search tool and click on the get and process button. Now compare the search results and you will see that most of the locked resource issues should now be gone.

We hope this article helped you to resolve 'Googlebot cannot access CSS and JS files' error on your WordPress site. You may also want to see our guide on

If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.