Google AMP as you know is the latest technology to help accelerate the mobile pages, but it has strict standards as to what you can do, just like any good technology.
AMP does not stop you from using your creativity. You can literally do anything you want on top of AMP but it has to be in a right way or else it won’t pass the AMP validation.
Better Validation has been our number one priority while developing AMPforWP plugin, it provides even better validation than the AMP by Automattic plugin.
Even if AMPforWP has the best validation support, Google search console will still report validation errors in Accelerated Mobile Pages section and there could be hundreds of reasons behind these error reports.
I was trying my best to help everyone by fixing their validation issues manually in search console. I must have validated hundreds of AMP websites validated, I decided to make a troubleshooting guide which will help not only our users but to the whole AMP community!
Things to remember before Jumping
- Real Examples: I’m posting these solutions and problems while debugging, so the code that you will see is from one of the users of the plugin. It is possible that the solution is either same or similar to the one provided in the guide.
- Always under progress: We’re constantly updating this troubleshooting guide as we find new solutions.
- It’s gonna be fine: AMP troubleshooting can be overwhelming. So, if you find yourself lost in this article, that’s perfectly normal. Just spend some time and it will help you understand the concept.
- Get involved: Please get involved with us from the comments section.
Divide the Errors into Categories:

By default, GSC (Google Search Console) breaks down the errors into 10 categories.
- Prohibited or invalid use of HTML Tag
- AMP markup missing or incorrect
- Prohibited HTML Tag with AMP equivalent
- User-authored JavaScript found on page
- Invalid CSS stylesheet
- Major content mismatch
- Use of deprecated tags or attributes
- Minor content mismatch
- Invalid structured data element
- Add AMP structured data, if supported
We will also break the errors and their solutions into these categories.
1. Prohibited or invalid use of HTML Tag
- 1) The attribute ‘xml:lang’ may not appear in tag ‘span’.
This means that there is an attribute in the HTML tags, which are not allowed by AMP. When we check the source code of the AMP version, we found this:

Solution: There are two ways of fixing this: One is that you go to your WordPress content editor, find this and remove this tag. If you want this tag then the second solution is that you use Content overwrite feature to serve different content to AMP version.
- 2) Multiple Errors in Categories and Tags Pages
The attribute 'prefix' may not appear in tag 'html ⚡ for top-level html'.
The mandatory attribute 'amp-custom' is missing in tag 'style amp-custom'.
Tag or text which is only allowed inside the body section found outside of the body section.
The attribute 'style' may not appear in tag 'img'.
The attribute 'type' may not appear in tag 'noscript > style[amp-boilerplate] - old variant'.
Solution: If you are getting multiple errors in just category and tags pages, then you don’t need to worry about this because we do not have AMP on categories and tags. It will probably take a few weeks until Google reindexes all the pages properly.
- 3) The attribute ‘target’ may not appear in tag ‘button’.
There is a target attribute in the AMP HTML which not allowed by the validation. When we run it with the AMP validator, we found this:

Solution: There are two ways of fixing this: One is that you go to your WordPress content editor, find this and remove this tag. If you want this tag then the second solution is that you use Content overwrite feature to serve different content to AMP version.
Back to you
Please share your issues in the below comments, we will try our best to help you provide solutions to them.
History: Last Updated: 12 Jan 2017
We are always updating this guide with better solutions as we find them.
These are common AMP errors reported in Google Search Console. Hope you have solved your error, if not then let us know what is the error you are facing in the comment section below.
I had two validation errors across my content when I validate it. The errors are:
1. The attribute ‘public’ may not appear in tag ‘html !doctype’.
2. The attribute ‘system’ may not appear in tag ‘html !doctype’.
The two errors are just at the beginning of my html which happen to be the same forall my content. It goes like this:
The issue is, I have no idea about where to locate and edit this on my website.
Hi Issahaku,
Will you please contact our technical team from here- https://ampforwp.com/support/ they will help you as soon as possible.
The attribute ‘target’ may not appear in tag ‘div’: ¿What does it mean? How to solve it? What it is exactly “target”?
Hi Carol,
Will you please contact our technical team from here- https://ampforwp.com/support/ they will help you as soon as possible.
how to solve structure data element error on search console in this site https://www.techshole.com/ 12 page effect this problem.
“JavaScript Custom No Allowed ” all my amp post error in search console. please help me https://buat.web.id/ this my website thx
Hi Buat Web Id,
Will you please contact our technical team from here- https://ampforwp.com/support/ they will help you as soon as possible.
How can I solve the problem of “The image size is smaller than the recommended size” Please respond and solve the problem Thank you.
Hi Anas,
Will you please follow this tutorial – https://ampforwp.com/tutorials/article/how-to-solve-image-size-smaller-than-recommended-size-in-amp/ And if you have any issues/problems after following this tutorial also then please let us know and we will personally help you.
I’ve this problem, can you help me to resolve :
The referenced AMP URL is a canonical AMP URL only
Thank you
Hi Christophe,
Will you please contact our technical team from here- https://ampforwp.com/support/ they will help you as soon as possible.
I found AMP error in google search console :
Only amp-boilerplate and amp-custom ‘style’ tags are allowed, and only in the document head.
Custom JavaScript is not allowed.
My website is mycustomketodietplanssok.com
please help
Hi Veasnanimol Sok,
Will you please contact our technical team from here- https://ampforwp.com/support/ they will help you as soon as possible.
I get this error in my AMP pages that use your plugin: “An AMP component ‘script’ tag is present, but unused”. Specifically, ‘amp-animation’ . I do not know how to remove it…
Hi Patricia,
Will you please contact our technical team from here- https://ampforwp.com/support/ they will help you as soon as possible.
I already did. Twice
Hi Patricia,
Could you send me the URL where you are getting the error so that we will understand and help you.
They are more than 100 urls affected, by my Google Search Console. For example https://vagamundosviajeros.com/galicia-ribeira-sacra-enoturismo-viticultura-heroica/amp/