How To Fix Googlebot cannot access CSS and JS files Warning In WordPress

fix Googlebot cannot access CSS and JS files warning in WordPress

Are you getting an error showing that your website is blocking Googlebot to access the CSS and the JS files?

By default, WordPress doesn’t block any of the design files. But some website owners add an extra code to improve the security which may block Googlebot.

In this tutorial, you will learn how to fix Googlebot cannot access CSS and JS files warning in WordPress. Such type of errors can influence the SEO ranking of your website.

Google tries to rank the websites which are user-friendly and easy to access. If any of the design files are blocking Googlebot, it can be a negative point.

Search For the Blocked Files from Your Google Search Console.

First of all, you should add your WordPress website to Google Search Console to analyze it. I hope you have already done that.

Now log in to your account and open the GSC dashboard.

Navigate to Crawl>>Fetch as Google and a page will appear. You don’t need to add anything extra. It’s because you’re analyzing the home page of your website.

fix file blocking

Click on the “Fetch and Render” button and within a few seconds, it will get completed.

You will see all the paths you have fetched before.

To see those blocked pages, go to Google Index>>Blocked Resources and a graph will appear to you.

fix file blocking warning

It will show the number of pages which block the Googlebot to scan your website.

To know those particular files, you can click on the URL of your website and it will show all the files.

Fix Googlebot cannot access CSS and JS Files Warning In WordPress Using the robots.txt file.

You should know that a robots.txt file handles the crawling of your website. It guides the Googlebot to crawl your website.

There are many sensitive files and folders which shouldn’t be crawled and indexed in the search engine.

The normal robots.txt file looks like this.

User-agent: *

Disallow: /wp-admin/

Disallow: /wp-includes/

Disallow: /wp-content/plugins/

Disallow: /wp-content/themes/

Many website owners copy and paste some extra code in this file which can block the Googlebot.

Sometimes, any of your plugins or themes is responsible for blocking the access. As mentioned above, you can easily find the path of that file.

Suppose the file is present in the wp-includes folder. To allow access, you have to add that file in the robots.txt file.

You can edit this file from the cPanel.

Go to cPanel>>files>>file manager>>robots.txt file. It’s just a text file and you can find it in the root directory of your website.

If you have moved your website or using any subdomain then search that folder.

To fix Googlebot cannot access CSS and JS files warning in WordPress, you have to allow the files.

Allow: /wp-includes/js/

Add such type of code in your robots.txt file. Don’t forget to replace the file path. It may be present somewhere else.

Another way to Edit robots.txt File.

If you’re afraid of the cPanel and using the Yoast SEO plugin then you can edit this file from your WordPress admin panel only.

Just navigate to SEO>>Tools>>File Editor and the robots.txt file will open.

fix Googlebot cannot access CSS and JS files warning in WordPress

Use the same type of code mentioned above. Choose the path of the file carefully. Don’t mistakenly allow the folders to get indexed which shouldn’t.

The code shown above means that you have allowed Googlebot to access only “js” file present inside the wp-includes folder.

You are still blocking access to the wp-includes folder.

After that go again to the crawling section and use the fetch and render button again. Check the number of pages blocked from the Google index.

If you don’t get any, congrats. You have successfully solved the problem. I hope now you can fix Googlebot cannot access CSS and JS files warning in WordPress. If you have any doubt, feel free to drop a comment.

You can also connect with us on Twitter, LinkedIn, and Facebook.

by Ravi Chahar

A WordPress Professional, web developer and designer who intends to guide his readers about WordPress, Blogging, Web Development, Web Design and more. I have expertise in WordPress theme development and customization. I can set up and redesign the Thesis themes. I have been working in this field for years now.

3 comments

  1. In one of my website, all the articles are getting indexed, but I am facing issue with one particular post. It is not getting indexed, no matter what I try.
    Could you please give me any solution regarding the same.

    1. Hey Hazel,

      Either the permalink structure has been changed or the content is deindexed by Google. If you’re using the CSS or JS files, they only affect the design of your website. No correlation with indexing.
      For indexing, try to update that post or maybe redirect to a new one.
      ~Ravi

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge