Ask questionsAllow Developer Tools to be turned off to minimize (even hide) validation error info
AMP validation error notices are concerning to non-technical users:
Rejection of validation errors should be limited to higher-privileged users, with Authors and Contributors (or other non-Admin role) shown validation errors warnings that just prompt them either to remove the invalid block (#2285) or to escalate the error to an administrator for support.
There should perhaps be a filter to configure the verbosity of the warnings for authors. There's a tough balance here because at one hand the warnings could be hidden to not concern users, but then at the same time the errors mean that markup is being removed. So if the validation error notice is not presented to the user, there needs to be a way for those validation errors to be escalated to an administrator.
Do not alter or remove anything below. The following sections will be managed by moderators only.
amp_validatecapability which by default is mapped by the
manage_optionscapability (in the same way as
customizeis by default granted by
Answer questions westonruter
On a related note, I think the “Enable AMP” checkbox should be only presented to administrator users. Instead of non-admin authors seeing AMP validation errors and just going straight to disabling AMP for the post, they should instead be directed to contact the administrator to get advice on the issue and then the administrator can decide whether to disable AMP for the post.
Furthermore, the “Enable AMP” checkbox should be gated behind whether developer tools are enabled, not just whether the user is an administrator. For more on this, see https://github.com/ampproject/amp-wp/issues/1864#issuecomment-631850402.