Google trying to index child theme files

I have created a child theme as per WordPress recommendation to customize my site.It is working as expected however, I am seeing some Server error (5xx) reports in the Google search console.

It seems that google is trying to index all the php files under the child theme.I am not sure what is reason behind this or how can I stop google to not index anything in the child theme.

I did some research and few people are suggesting to use

if ( ! defined( ‘ABSPATH’ ) ) {
header( ‘HTTP/1.0 403 Forbidden’ );
to block direct access to these files.Is there any other solution to handle this issue in WordPress?

Read more here:: Google trying to index child theme files

Leave a Reply

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