WordPress Google Search Console Fix: Invalid AMP Tags (amp-form extension JavaScript)

How to Fix “The Tag ‘FORM [method=GET]’ amp-form” error in WordPress

This fix is for WordPress users that have enabled AMP(Google Accelerated Pages) in WordPress. Google AMP comes with it’s own advantages for SEO and to make pages come up faster in search engines.

If you get an error message from Google Search Console about few or thousands of your WordPress web pages that are affected with the: “The tag ‘FORM [method=GET]’ requires including the ‘amp-form’ extension JavaScript” then, you are not alone. Has this problem is due to one or more plugin that haven’t had amp coded into it.  Examples of such plugins are various form plugins which implements options for users of your WordPress sites to submit personal information, like email and news letter. E.g. like, the Optin Form plugin, mailchimp plugin etc.

Though this plugins in subsequent updates should have amp coded into it to support the amp-form. But, before that happens, you can manually put amp-form support unto your WordPress blog or site without having waiting for the plugin creators to implement an update. It’s also a cool thing to implement the update yourself just in case another plugin comes up with similar needs. You may get in your inbox or Search Console a message like this:

To fix this error, is pretty straight to the point. And any one can implement it. Just implement the following codes provided below into your WordPress Site or blog and the follow through procedures; after which you go back into your Google Search Console under AMP and Re-Validate the pages as error fixed by clicking on the Re-validation button provided in Google Search Console.

Here is the follow through procedures:

Fix WordPress Tag amp-form extension JavaScript error in WordPress

#1. Implement amp-form by Logging into WordPress Site/Blog:

  • Log into your WordPress Site or Blog,
  • Goto the option of Appearance
  • And Scroll down to Editor. 
  • Open the Editor tab in another page of your browser.
  • Locate the Theme Files tab
  • Scroll down to the Theme Header (Header.php) option
  • Open the Theme Header (Header.php) file in another tab
  • Inside the Header.php editor, go to the bottom on a new line at the end of the codes and copy, then paste this: <script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
  • Click on the Update File button to save the code.

#2. Include the Amp-Form function in Theme Functions.php

  • On this same page under Theme Files tab. Scroll to Theme Functions(Functions.php)

  • Open the Theme Functions.php file in another tab.
  • Scroll down to the end of the editor where all the codes are in, ensure you don’t alter any coding.
  • In a new line at the end of your Theme Functions(Functions.php) codes, copy and paste this:
    add_filter( 'amp_post_template_data', function( $data ) {
    $data['amp_component_scripts'] = array_merge(
    $data['amp_component_scripts'],
    array(
    'amp-form' => 'https://cdn.ampproject.org/v0/amp-form-latest.js',
    )
    );
    return $data;
    } );
  • Click on the Update File button to save the code. This code helps include the amp-form function into WordPress.

#3. Validate amp-form fix in Google Search Console

  • Go to the URL given in your mail inbox of the problem or Login directly into Search Console
  • Go under amp.
  • Then click on the Validate fix button( This carries out a re-evaluation of the links to see if everything is up and fine).

    

You can see from the image, have already click on the validate button to run crawling once more, ‘so you don’t see the button in the image’.

Quick Notes:

The Re-Validation process may take upto 48 hours or 72 hours thereby. Because, it usually requires Google bots to crawl through the affected pages. All depends on the amount of contents you have spilled into the web. Therefore simply click on the Validate fix button and go get yourself a coffee. Come back to check into your Search Console, after 2 days.

In addition, you can also clear the cache of your WordPress site, if you have any caching plugin installed in order to reflect a recent change made on your blog or site.

Hope this helped! For any questions, just drop it in the comment sections. Thanks!. Remember to share!.


Get Stuffs Like this, to Ur' Inbox:

Leave a Reply

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