Custom JavaScript is not allowed | Google Search Console Error

This error generally occurs for AMP pages and it specifically occurs when the AMP pages of website are first indexed by Google or when there is a new page to be indexed. This error is due to addition of script tag in the Header section of the HTML page. (It occurs if we add any javascript in the header section of the AMP page)


The error might be displayed in Google Search Console as shown above. To fix this error just remove the Javascript code from the header section. If we are using a WordPress site, you may need to remove the scripts that is placed in the header section. Specifically if you are using AMP for WP then follow the below steps to remove the code


Step 1: Go to AMP for WP Plugin under WordPress

Step 2: Click on Advance settings and then scroll down to Enter HTML in the Head as shown

Step 3: Remove any other scripts other than AMP script that’s already available and once it is fixed. You can test your page via Google’s AMP Test page to validate your fix. If the test fails keep looking whether there are any other scripts that are being inserted in the AMP page.

Scroll to Top