Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AMP dev mode #505

wants to merge 2 commits into
base: develop


Copy link

commented Sep 8, 2019

Fixes #438.


Depends on ampproject/amp-wp#3187.

As noted in ampproject/amp-wp#1921, AMP now supports a dev mode (ampproject/amphtml#20974) which allows a document to mark certain elements as being excluded for AMP validation. This is exactly what the AMP plugin has needed to allow the admin bar without fighting against the 50KB CSS limit. It also opens up the door to using scripts on AMP pages to add interactivity to the admin bar without worrying about AMP compatibility. This is exactly what Site Kit has needed for its admin bar integration on AMP pages.

This PR begins to implement support for that. I'll need help to complete it. In short, any markup that is being added by Site Kit to the frontend should be amended with the data-ampdevmode attribute to each element. The elements in the admin bar items will get this automatically, so the primary concern is the script, link, and style elements that are output to integrate Site Kit on the frontend admin bar.

Relevant technical choices

  • Add data-ampdevmode to elements for scripts and styles on AMP pages to exempt them from AMP validation.


  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 4.7 and PHP 5.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have signed the Contributor License Agreement (see
@westonruter westonruter requested a review from felixarntz Sep 8, 2019
@googlebot googlebot added the cla: yes label Sep 8, 2019
@westonruter westonruter referenced this pull request Sep 8, 2019
17 of 17 tasks complete

This comment has been minimized.

Copy link
Member Author

commented Sep 10, 2019

FYI: I've attached a build of the AMP plugin with a link the PR description at ampproject/amp-wp#3187


This comment has been minimized.

Copy link
Member Author

commented Sep 13, 2019

@felixarntz I forgot that I had created an issue for this. See #438. Updated description to indicate the relationship.


This comment has been minimized.

Copy link
Member Author

commented Oct 1, 2019

AMP plugin v1.3 has now been released with the Admin Bar support. Can this be moved forward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.