Skip to content

Releases: ampproject/amp-wp

2.0.3

18 Sep 20:01
c42478a
Compare
Choose a tag to compare

This is a quick follow up on yesterday's 2.0.2 release. The 2.0.3 milestone includes just one change. See full diff of changes.

Changelog

  • Fix extraction of class names from string literals in [class] attributes. This fixes a problem where toggling mobile nav menus stopped working. #5401, #5403

Props

Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:

Alain Schlesser (schlessera), Alberto Medina (amedina), Pierre Gordon (pierlon), Weston Ruter (westonruter)

Installation

Now available to install via WordPress.org.

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

To install as a Git submodule, consider 2.0.3-built.

2.0.2

18 Sep 02:44
d96052e
Compare
Choose a tag to compare

This release follows up on 2.0.0 and 2.0.1, fixing a few issues reported in that release as well as making a few other enhancements.

For the full list of issues and pull requests in this release, please see the 2.0.2 milestone, with 9 closed issues and 20 merged pull requests. See full diff of changes.

Changelog

Developers

  • Identify the theme or plugin responsible for calling amp_is_request() (is_amp_endpoint()) or amp_is_available() prematurely when the _doing_it_wrong() usage notice is raised. Also identify the theme/plugin that is responsible for causing a fatal error during post-processing to display on the resulting error page. #4602, #5289
  • Ensure amp_is_available() returns false when accessing Database Repair screen. #5362
  • Ensure the GitHub link to the source is formed correctly in generated documentation. #5359
  • Remove instances of @return annotation in hook documentation. #5344

Performance

  • Cache error index counts and URL count in “At a Glance” dashboard widget, eliminating the need to run additional SQL queries with each admin page load. #5271, #5343
  • Only add_admin_menu_new_invalid_url_count when post type is show_in_menu. #5336

Sanitization & Validation

  • Gracefully handle sanitization of validation errors caused by use of i-amphtml-* in CSS selectors or class attributes. Instead of removing the entire style[amp-custom] or the entire class attribute, now just the invalid CSS selector or class name will be removed. #771, #5356
  • Update AMP validator spec to 2008290323001 and improve i-amphtml-* sanitization. #5356
  • Validate and sanitize image candidates in srcset attributes. This prevents the sanitizer from leaking an error: “Multiple image candidates with the same width or pixel density found in attribute ‘srcset’ in tag ‘amp-img’.” #5358, #5366
  • Gather required script components even for kept invalid markup. #5388
  • Prevent fatal error during post-processing from being masked by a notice. Call error_get_last() prior to calling sanitizers. #5375
  • Fix parsing of turn unit in CSS. #4604, #5392
  • Update button text used in the locked post dialog when editing a validated URL post. #5354

Settings Screen & Onboarding Wizard

  • Avoid showing blank settings drawer for Plugin Suppression when no other suppressible plugins are active. Show message instead. #5310, #5349
  • Fix ability to complete onboarding when Twenty Twenty is chosen as Reader Mode on a Twenty Twenty site. Override Reader mode selection and re-set page index before reaching done screen. #5351, #5361
  • Harden presentation of available Reader themes. Ensure get_default_reader_themes returns an array and sets the array as a class attribute, and handle failed themes_api in UI. #5367, #5368

Reader Mode

  • Prevent showing Gutenberg's new Widget Blocks section in Customizer for a Reader theme, since widgets in general are not currently supported in Reader mode. #5322, #5338
  • Ensure robots meta tag is added to AMP legacy template when search engines are discouraged. #5339
  • Fix displaying relative publish date/time in legacy AMP post template when timezine is not UTC. Ensure post_publish_timestamp in AMP_Post_Template is UTC for human_time_diff(). #5335

Testing

  • Allow test in Test_AMP_Core_Block_Handler to run now that WordPress/gutenberg#25026 has been merged. #5347
  • Fix test_add_block_source_comments with latest_posts dataset when Gutenberg installed from source. #5346

Props

Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:

Alain Schlesser (schlessera), Alberto Medina (amedina), James Osborne (jamesozzie), John Watkins (johnwatkins0), Joshua Wold (jwold), Kasper Myram (kmyram), Pascal Birchler (swissspidy), Pierre Gordon (pierlon), Renee Johnson (ernee), Weston Ruter (westonruter)

Installation

Now available to install via WordPress.org.

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

To install as a Git submodule, consider 2.0.2-built.

2.0.1

04 Sep 00:33
4ddf199
Compare
Choose a tag to compare

This release follows up on 2.0.0, fixing a few issues reported in that release as well as making a few other enhancements.

For the full list of issues and pull requests in this release, please see the 2.0.1 milestone, with 9 closed issues and 14 merged pull requests. See full diff of changes.

Changelog

  • Disable AMP Developer Tools by default when a site is in Reader mode; add amp_dev_tools_user_default_enabled filter to override whether DevTools enabled by default. #5286, #5333
  • Fix enabling AMP-to-AMP linking when mobile redirection is active. #5323
  • Catch exceptions thrown during AMP post-processing and show WordPress error screen with 500 Internal Server Error response. Show the exception details including stacktrace when WP_DEBUG_DISPLAY is enabled; emit to PHP error log if fatal error logging is enabled. Also provide link to go to non-AMP version when in Transitional or Reader mode. #5315, #5320
  • Let "Review issues" link in block editor warning notice for AMP validation error open in new tab. #5319
  • Prevent excessive regular expression backtracking when purging obsolete data-amp-* attributes when editing very long posts in the block editor. #5308, #5313
  • Apply post-processing if html tag contains amp attribute, not only if templates fire head/footer template actions. #5314, #5316
  • Accept removal of AMP-invalid @-moz-document CSS at-rules in Twenty Nineteen which were added in WP 5.5. This is a temporary workaround while waiting for ampproject/amphtml#26406. #5302, #5305
  • Expand regular expression matching for Pinterest oEmbed URLs. #5291,
    #5299
  • Ensure AMP_QUERY_VAR is defined for plugins that expect it (e.g. to sniff for presence of AMP plugin). #5290, #5294
  • Fix supplying schema for AMP options REST API endpoint. #5281, #5283
  • Hide label for "Hide Controls" button in Customizer, and improve positioning of legacy AMP toggle. #5252, #5284
  • Docs: Fix filtering of internal and deprecated elements during file parsing. #5301
  • Make detection of invalid sizes/media attributes stricter. #5287
  • Print amp-default.css via amp_post_template_css action instead of in overridable style.php AMP legacy template. #5282

Props

Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:

Alain Schlesser (schlessera), Alberto Medina (amedina), Brandon Payton (brandonpayton), Daniele Scasciafratte (Mte90), Fellyph Cintra (fellyph), James Osborne (jamesozzie), Jaroslav Polakovič (dero), John Watkins (johnwatkins0), Joshua Wold (jwold), Kasper Myram (kmyram), Pascal Birchler (swissspidy), Pierre Gordon (pierlon), Renee Johnson (ernee), roo2, Weston Ruter (westonruter)

Installation

Now available to install via WordPress.org.

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

To install as a Git submodule, consider 2.0.1-built.

2.0.0

27 Aug 01:49
77ddc46
Compare
Choose a tag to compare

We are very excited about this v2.0 release of the official AMP plugin for WordPress! Lots of work went into this release, and it is loaded with many improvements and new capabilities in the areas of usability, performance, and flexibility. Originally this was going to be v1.6 but due the major changes we decided it warranted a major version bump.

For the full list of changes in this release, please see the 2.0 milestone, with 141 closed issues and 174 merged pull requests.

The key highlighted features in this release include:

  • Expanded Reader Mode with full-site coverage (rather than being limited to singular posts and pages as in legacy Reader mode), template and design variations from selecting alternate themes to better match your site's brand, and support for standard WordPress features like nav menus, custom logo, and commenting.
  • Onboarding Wizard and revamped Settings Screen which make configuring the plugin more intuitive, explaining the three template modes (Standard, Transitional, Reader), and indicating which may work best for the site and for the user's technical ability.
  • Plugin Suppression to provide administrators with a new option for how to deal with plugins that cause validation errors by turning off selected plugins when generating AMP pages.
  • Mobile Redirection to facilitate sites in Transitional/Reader modes where AMP intended to be used as the mobile version of the site.
  • Improved Developer Tools allowing validation to be turned off for users who don't want it and improving validation workflow for users who do.

Read on for the full details.

Changelog

Expanded Reader Mode

Reader mode now allows for any AMP-compatible theme to be used to serve AMP pages, rather than just the legacy post templates. This allows for long-requested features including nav menus, logos, commenting, and template design variations. It also makes it possible to serve all URLs of a Reader-mode site in AMP, as opposed to just singular posts. The old Reader mode AMP post templates are still available as a "Legacy" theme which is not going away, but it remains limited to serving AMP for singular posts.

To recap the modes: in Standard mode, there is one theme and one version of the site; Standard mode is AMP-first, where there are no AMP-specific URLs as AMP is the canonical (and only) version of the site. In Transitional mode, there is still one theme but there are two versions of the site, where each canonical non-AMP URL may have a separate paired AMP version. Reader mode takes this a step further: the site has two themes, and the active theme is used for canonical non-AMP URLs and the Reader theme is used for AMP URLs. The Standard mode is the recommended mode since it means desktop and mobile visitors both get the speed benefits of AMP and there is less to maintain with only one version/theme on the site. Reader mode is a good choice when the active theme is not AMP-compatible and thus not suitable for Standard or Transitional. Transitional is useful in cases where a partially AMP-compatible theme is used, and the user either wants to do development to make the site fully AMP compatible (i.e. transition to AMP-first), or simply wants a simpler setup.

If at any time the active theme is switched to be the same as the one selected for Reader mode, then the plugin automatically switches from Reader mode to Transitional mode. This is because the site now will behave as if Transitional mode was selected since Reader mode involves two separate themes being used.

When a Reader theme is selected, the Themes screen in the admin will show both the primary theme and the Reader theme as both being active.

The paired browsing feature of the plugin remains limited to sites in Transitional mode, as it doesn't make much sense to see the AMP and non-AMP versions side-by-side if two different themes are being used.

When serving an AMP page with the theme selected in the new Reader mode (i.e. non Legacy), all of the standard WordPress theme hooks are used to extend the templates. So to add something to the footer, use the wp_footer action instead of amp_post_template_footer. Actions prefixed with amp_post_template_* are limited to the legacy Reader theme templates. To know which version should be used in a given site, use current_theme_supports('amp') which will return true if an AMP page must be served without the legacy theme.

Note: The old legacy Reader mode templates from v0.3 are now marked as deprecated. So if you're using amp_backcompat_use_v03_templates(), then you should really be migrating to using the current legacy Reader templates, or better still switch to using Reader themes. #5218

AMP Customizer for Reader Mode

When a Reader theme is selected, there will then be two versions of the Customizer available: the default Customizer for the active theme, and the AMP Customizer for the AMP Reader theme. Since in Standard and Transitional modes only one theme is used, only one version of the Customizer will be used. The AMP Customizer can be accessed via the Customize link in the admin bar on an AMP page, or via the admin menu, or via the AMP settings screen. The fact the Customizer is currently editing the AMP version of the site is clearly displayed, along with a link to switch to the main non-AMP Customizer. The AMP Customizer opens with the “Tablet” device being selected for preview by default; this viewport corresponds to the screen size of modern smartphones and it doesn't make sense to default to preview the Desktop viewport size since the vast majority of visitors to AMP pages will be on mobile devices when Reader mode (or Transitional mode) is enabled.

In the AMP Customizer, you can assign the same nav menus used in your active theme to nav menu locations used in the Reader theme. There is also be the ability to copy the theme modifications from the active theme over to the Reader theme so you can preview and tweak how the logo, background color, header, and other settings look in the Reader theme prior to publishing. Any Customizer control for general site options (like the Site Title) include a notification indicating they also apply to the non-AMP version of the site. The Additional CSS section of the Customizer allows you to tweak the styles of the Reader theme separately from the Additional CSS modifying the styles of the active theme. Note that widgets are not supported on AMP pages with a Reader theme, so the Widgets panel of the AMP Customizer is removed. The Homepage Settings section is also removed since it exclusively contains global site options that are not specific to the AMP version of the site. The Themes panel is also removed in the AMP Customizer; switching Reader themes currently must be done from the AMP settings screen.

When the “Legacy” Reader theme is selected, there is only a single version of the Customizer is available; the AMP panel in the Customizer here remains for making changes to the appearance of the legacy post templates.

Non-AMP Customizer AMP Customizer for Reader theme
Non-AMP Customizer AMP Customizer

Initialization in Reader Mode

When a Reader theme is selected, a request for an AMP page will cause the Reader theme to be loaded instead of the active theme. This is using the same logic the Customizer uses to switch themes during preview. An important implication of this is that if you have custom post types, taxonomies, blocks, or shortcodes—these must be registered in plugins instead of your theme in order for them to be available on AMP pages. It is already a best practice to do such registration in plugins, but WordPress does not enforce it. The plugin will soon also provide a theme scanning capability which will detect whether the active theme is doing any such registrations in order to warn you before activating a Reader theme (see #4795).

Loading a Reader theme on an AMP request happens at the plugins_loaded action (at priority 9). The Reader theme is loaded this early to ensure it can be accessed in the Customizer and that all of the theme's functionality can be initialized properly. If you customize the query param used for AMP URLs to be different from the default of amp (via the amp_query_var filter) then you must do this in a plugin before this plugins_loaded action occurs. Otherwise, you will not be able to select a Reader theme other than Legacy. Reader themes require the use of a URL query param (e.g. ?amp=1) as opposed to an endpoint (e.g. /amp/), though we intend to improve the customization of this in the future (see #2204).

Adding Reader Themes

By default any of the core themes may be selected for Reader mode (except for the non-responsive Twenty Ten). The plugin will likely add more AMP-compatible ecosystem themes to the default list in the future, but if you'd like to include a custom AMP-compatible theme to the list there is a filter to do so, for example:

add_filter( 'amp_reader_themes', function ( $reader_themes ) {
	$reader_themes[] = [
		'name' => 'Neve',
		'slug' => 'neve',
		'preview_url' => 'https://wp-themes.com/neve',
		'screenshot_url' => 'https://i0.wp.com/themes.svn.wordpress.org/neve/2.7.5/screenshot.png?w=1144&s...
Read more

2.0.0-RC2

26 Aug 01:44
ce8add3
Compare
Choose a tag to compare
2.0.0-RC2 Pre-release
Pre-release

This is the second release candidate for v2.0. For an in-depth overview of the changes in v2.0 as a whole, please see the v2.0.0-beta1 release notes as well the v2.0.0-beta2, v2.0.0-beta3, and v2.0.0-RC1 changelogs. Also compare the diff between RC1 and RC2.

Since the first release candidate beta, an additional 5 issues have been closed and 14 pull requests have been merged. For the entirety of what is coming in this release, see the 2.0 milestone.

Please report any issues you encounter while testing! The scheduled release date for v2.0.0 final is August 18th 25th 26th.

Changelog

Reader Mode

  • Default to tablet device preview when opening legacy AMP Customizer. #5257, #5258
  • Prevent wp_print_service_workers() from happening at wp_print_footer_scripts in legacy Reader mode. #5270

Settings Screen and Onboarding Wizard

  • Ensure that success notice is displayed after repeated saves on settings screen. #5264, #5265

Mobile Redirection

  • Ensure the mobile version switcher link is styled properly in all core themes. #5251, #5255

CSS

  • Fix layout bug with navigation menu in Twenty Twelve by replacing focus selector with a common class selector when used in a descendant combinator. #5246, #5248

Validation

  • Cherry pick AMP validator spec update to fix validation of loop attribute for amp-bodymovin-animation component. #5245, #5267

Developer Tools

  • Remove checkbox column from error index since bulk actions removed. #5266
  • Only show fatal errors on Validated URL screen when WP_DEBUG_DISPLAY is enabled. #5243

Optimizer

  • Reverse style traversal when turning sizes attribute into CSS. #5263

Documentation

  • Update link to analytics documentation. #5262
  • Add missing internal tags on deprecated code. #5261
  • Annotate AnalyticsOptionsSubmenu class as internal. #5260
  • Add missing @internal tag to function in bootstrap file. #5259

Tech Debt

  • Remove unused REMOVED_SOURCES constant. #5269

Props

Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:

Alain Schlesser (schlessera), Alberto Medina (amedina), John Watkins (johnwatkins0), Joshua Wold (jwold), Kasper Myram (kmyram), Pierre Gordon (pierlon), Weston Ruter (westonruter)

Installation

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

To install as a Git submodule, consider 2.0.0-RC2-built.

2.0.0-RC1

15 Aug 04:46
767e273
Compare
Choose a tag to compare
2.0.0-RC1 Pre-release
Pre-release

This is the first release candidate for v2.0. For an in-depth overview of the changes in v2.0 as a whole, please see the v2.0.0-beta1 release notes as well the v2.0.0-beta2 and v2.0.0-beta3 changelogs.

Since the third beta, an additional 7 issues have been closed and 15 pull requests have been merged. For what is left to do in this release, see the 2.0 milestone.

Please report any issues you encounter while testing! The scheduled release date for v2.0.0 final is August 18th 25th.

Changelog

Reader Mode

  • Facilitate themes marking themselves as AMP-compatible. In addition using the amp_reader_themes filter in a plugin to add themes to the list of Reader themes, installed themes can include themselves in the list by adding AMP: true to their style.css. Additionally, they can provide a screenshot-mobile.png (or screenshot-mobile.jpg) alongside the theme's normal screenshot.png for better presentation in the list of Reader themes. #5222, #5230
  • Make homepage, description, and name all optional fields for Reader themes. #5212
  • The old legacy Reader mode templates from v0.3 are now marked as deprecated. So if you're using amp_backcompat_use_v03_templates(), then you should really be migrating to using the current legacy Reader templates, or better still switch to using Reader themes. #5218

Settings Screen and Onboarding Wizard

  • Restore Analytics admin menu item to link to jump to expanded Analytics drawer on settings screen. #5190, #5216
  • Improve placement of buttons in onboarding wizard on mobile viewports. #5193, #5211
  • Onboarding wizard: reduce size height of navigation bar at smaller widths. #5234, #5235

Analytics

  • Add analytics vendor type checking; rewrite documentation in Analytics section. #5199
  • Improve amp-analytics guidance when googleanalytics or gtag are selected. #5200

Initialization

  • Eliminate regex used to determine if content from output buffer is a valid HTML document since done actions now used. #5217
  • Abort AMP post-processing if an expected template actions are not triggered (e.g. wp_head and wp_footer). #5202

Mobile Redirection

  • Defer mobile redirection to end of template_redirect action. #5203
  • Ensure non-AMP link in paired browsing does not redirect to AMP version. #5214

Documentation and PHP API

  • Add @internal phpdoc tags to all classes, functions, and hooks not intended for developers to use. #5119, #5218
  • The function is_amp_endpoint() has been renamed as AMP-prefixed amp_is_request() and post_supports_amp() has been renamed as amp_is_post_supported(). The old non-prefixed versions still exist, but they are soft-deprecated as aliases and won't be raising deprecation warnings. #5218, #5231
  • The misnamed amp_frontend_show_canonical filter is also now marked as deprecated. #5218

Misc

  • Amend amp_get_current_url() to return null if the home URL cannot be parsed. #5051, #5219
  • Apply https_local_ssl_verify filters for sslverify in validation loopback requests. #2287, #5237

Props

Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:

Alain Schlesser (schlessera), Alberto Medina (amedina), John Watkins (johnwatkins0), Joshua Wold (jwold), Kasper Myram (kmyram), Pierre Gordon (pierlon), Weston Ruter (westonruter)

Installation

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

To install as a Git submodule, consider 2.0.0-RC1-built.

2.0.0-beta3

08 Aug 05:32
183be02
Compare
Choose a tag to compare
2.0.0-beta3 Pre-release
Pre-release

Update: 2.0.0-RC1 is now available.

This is the third beta pre-release for v2.0. For an in-depth overview of the changes in v2.0 as a whole, please see the v2.0.0-beta1 release notes as well the v2.0.0-beta2 changelog.

Since the second beta, an additional 13 issues have been closed and 17 pull requests have been merged. For what is left to do in this release, see the 2.0 milestone.

Please report any issues you encounter while testing! The scheduled release date for v2.0.0 final is August 18th.

Changelog

Reader Mode

  • Fall back to using Legacy theme if theme chosen for Reader mode was deleted. Show warning on AMP Settings screen and Themes screen. #5136, #5159
  • Ensure that a chosen Reader theme which was made available via the amp_reader_themes filter will continue to appear in the list of Reader themes (and be selected) even when this filter is removed. Add placeholder icons when no theme screenshots are available, and use the theme's own screenshot for Reader mode mobile preview if no other screenshot is available. #5070, #5159
  • Switch to AMP Legacy theme if the previously selected Reader theme is now the active theme for the site. #5102, #5170
  • Use UI font for mobile version switcher link in legacy Reader template. #5194

Settings Screen and Onboarding Wizard

  • Move analytics settings from separate page into "Advanced" section of AMP settings page. #5013, #5155
  • Fix possible JS error raised for themes.find not being a function. Improve handling of polyfilled assets (and improve handling of Reader themes data). #5147, #5164
  • Improve font sizes in onboarding wizard and settings screen and make a slew of other improvements that tighten up the UI. #5192
  • Update copy of onboarding flow last step. #5148, #5149
  • Improve styling of Plugin Suppression UI. #5145, #5158
  • Close output buffer in addition to cleaning after calling fs_connect. #5151

Initialization

  • Move amp_is_enabled filter to apply in amp_bootstrap_plugin() so that plugins can short-circuit all services from initializing. 👉 Please note that adding this filter now must be done before the plugins_loaded action! This is a backwards-incompatible change. Previously the filter was applied at after_setup_theme, and _doing_it_wrong() will now fire if a filter tries to disable AMP too late. #5152, #5153
  • Prevent finishing template rendering initialization if not on frontend. #5197

Validation

  • Allow boolean attributes to repeat attribute name as attribute value (e.g. disabled="disabled"). #5156, #5157
  • Prevent scoping total error index count in admin menu. #5144

Developer Tools

  • Delete parsed stylesheets from amp_validated_url posts once they become stale (older than 1 week). This reduces a lot of database storage. Restoring stylesheet information for a validated URL can be done by just re-checking the URL. #5132, #5150
  • Indicate reviewed status when viewing an individual validation error. #4805, #5196
  • Ensure paired browsing template_include filter overrides other filters. #5198

Routing

  • Rename is_amp_available() to amp_is_available(). #5165, #5195

Props

Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:

Alain Schlesser (schlessera), Alberto Medina (amedina), John Watkins (johnwatkins0), Joshua Wold (jwold), Kasper Myram (kmyram), Paola Stoyanova (PaolaStoyanova), Pierre Gordon (pierlon), Piotr Delawski (delawski), Weston Ruter (westonruter)

Installation

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

To install as a Git submodule, consider 2.0.0-beta3-built.

2.0.0-beta2

01 Aug 03:40
bc4ed0f
Compare
Choose a tag to compare
2.0.0-beta2 Pre-release
Pre-release

Update: 2.0.0-beta3 is now available.

This is the second beta pre-release for v2.0. For an in-depth overview of the changes in v2.0 as a whole, please see the v2.0.0-beta1 release notes.

Since the first beta, an additional 23 issues have been closed and 29 pull requests have been merged. For what is left to do in this release, see the 2.0 milestone.

Please report any issues you encounter while testing! The scheduled release date for v2.0.0 final is August 18th.

The key highlighted features in this release include:

Changelog

Reader Mode

  • Introduce ability to copy theme-specific settings (including logo, header, background image, colors, custom CSS, nav menu location assignments, etc.) from the Active theme to the Reader theme in the AMP Customizer. The functionality allows importing a subset of the settings from the Active theme. The imported settings are applied in the Customizer preview to ensure the modifications are appropriate prior to publishing them. Whenever subsequent changes are made to these settings in the Active theme the import mechanism is enabled to allow the updated settings to be imported to the Reader theme. #5039, #5137, #5041
  • Allow using child theme of selected Reader theme as the primary active theme. #5077, #5080
  • Ensure that the “Leave a Comment” link in Legacy Reader mode will direct users to to non-AMP version if mobile redirection is enabled. #4968, #5088
  • Disable CSS tree shaking and CSS limit in Customizer preview. This applies to Standard mode and in the AMP Customizer for Reader mode. #5104, #5105
  • Keep non-AMP Customizer link referencing the currently-previewed URL. #5107
  • Improve presentation of selected AMP Reader theme on the Themes screen, showing it as active alongside the Active theme. Prevent accidental deletion of the selected Reader theme. #5076

Settings Screen and Onboarding Wizard

  • Make template mode and reader theme sections more compact. Use drawers for template modes and Reader themes. Display Reader themes in carousel on settings screen. Eliminate top-level Advanced drawer in favor of an Advanced heading. #5017, #5067
  • Direct users who select a Reader theme in the onboarding wizard to finish their journey in the AMP Customizer so that the relevant settings can be imported from the active theme. #5045, #5092
  • Dynamically add the "Theme Selection" step in the onboarding wizard if Reader mode is selected. #5086, #5123
  • Update onboarding wizard stepper design elements. #5127, #5128
  • Improve copy on settings screen and onboarding wizard. #4684, #4871, #5116, #5124, #5125
  • Tighten up the overall design of the onboarding wizard. #5082, #5092
  • Prevent non-installable Reader theme from incorrectly being listed as available. #5048, #5139
  • Add REST preloading for settings screen and wizard, reducing the load time for accessing these screens. #5114, #5118
  • Eliminate obsolete re-validation when switching template modes. #5100
  • Compress reader mode theme screenshots. #5071
  • Ensure settings screen and onboarding wizard can be updated on readonly filesystems. #5142, #5143

Plugin Suppression

  • Allow any active plugin to be suppressed instead of only those which have introduced validation issues. This ensures that the Plugin Suppression section appears consistently on the settings screen, and users will be able to suppress plugins even when Developer Tools are turned off. Also improve the design of the plugins table. #5126, #5133

Embeds

  • Prevent gallery shortcodes form unexpectedly showing as carousels by default in Transitional/Standard mode (and when a Reader theme is selected). Allow gallery carousel to be turned off in legacy Reader mode, where it remains enabled by default. Prevent block validation errors from occurring when deactivating AMP plugin. Fix captions in carousel which contain markup. #4774, #4775
  • Remove obsolete Vine and Hulu embed handlers. #4673, #5072, #5073
  • Add missing context element for XPath when processing video shortcodes in Text widgets. #5066, #5074
  • Fix TikTok test. #5094

CSS

  • Update PHP-CSS-Parser library to prevent var() functions inside of rgba() from being dropped. #5023, #5081

Schema.org Metadata

  • Supply ImageObject type for publisher.logo in Schema.org metadata as opposed to a bare URL string. #5121

Parsing

  • Ensure emoji AMP attribute can be restored if non-space whitespace used between attributes. #5098
  • Restore noscript head elements immediately after parsing rather than at serialization to ensure that they are sanitized. #5097

Testing

  • Add PHP Compatibility testing to external libraries and use PSR-12 as baseline standard. #4655, #5084, #5085

AMP Validator Spec Updates

  • Update amphtml validator spec to commit 3aa007a (spec file rev 1060). #5075

Props

Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:

Alain Schlesser (schlessera), Alberto Medina (amedina), John Watkins (johnwatkins0), Joshua Wold (jwold), Kasper Myram (kmyram), Pierre Gordon (pierlon), Sjoerd Boerrigter (sboerrigter), Weston Ruter (westonruter)

Installation

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

To install as a Git submodule, consider 2.0.0-beta2-built.

2.0.0-beta1

20 Jul 19:02
b51629b
Compare
Choose a tag to compare
2.0.0-beta1 Pre-release
Pre-release

Update: 2.0.0-beta2 is now available.

We are very excited about the upcoming v2.0 release of the official AMP plugin for WordPress! Lots of work went into this release, and it is loaded with many improvements and new capabilities in the areas of usability, performance, and flexibility. Originally this was going to be v1.6 but due the major changes we decided it warranted a major version bump.

This is the first beta release for v2.0. For the full list of changes in this release, please see the 2.0 milestone, with 85 closed issues and 95 merged pull requests (so far). Please report any issues you encounter while testing! The stable release is scheduled for August 15th.

The key highlighted features in this release include:

  • Expanded Reader Mode with full-site coverage (rather than being limited to singular posts and pages as in legacy Reader mode), template and design variations from selecting alternate themes to better match your site's brand, and support for standard WordPress features like nav menus, custom logo, and commenting.
  • Onboarding Wizard and revamped Settings Screen which make configuring the plugin more intuitive, explaining the three template modes (Standard, Transitional, Reader), and indicating which may work best for the site and for the user's technical ability.
  • Plugin Suppression to provide administrators with a new option for how to deal with plugins that cause validation errors by turning off select plugins during when generating AMP pages.
  • Mobile Redirection to facilitate sites in Transitional/Reader modes where AMP intended to be used as the mobile version of the site.
  • Improved Developer Tools allowing validation to be turned off for users who don't want it and improving validation workflow for users who do.

Read on for the full details.

Changelog

Expanded Reader Mode

Reader mode now allows for any AMP-compatible theme to be used to serve AMP pages, rather than just the legacy post templates. This allows for long-requested features including nav menus, logos, commenting, and template design variations. It also makes it possible to serve all URLs of a Reader-mode site in AMP, as opposed to just singular posts. The old Reader mode AMP post templates are still available as a "Legacy" theme which is not going away, but it remains limited to serving AMP for singular posts.

To recap the modes: in Standard mode, there is one theme and one version of the site; Standard mode is AMP-first, where there are no AMP-specific URLs as AMP is the canonical (and only) version of the site. In Transitional mode, there is still one theme but there are two versions of the site, where each canonical non-AMP URL may have a separate paired AMP version. Reader mode takes this a step further: the site has two themes, and the active theme is used for canonical non-AMP URLs and the Reader theme is used for AMP URLs. The Standard mode is the recommended mode since it means desktop and mobile visitors both get the speed benefits of AMP and there is less to maintain with only one version/theme on the site. Reader mode is a good choice when the active theme is not AMP-compatible and thus not suitable for Standard or Transitional. Transitional is useful in cases where a partially AMP-compatible theme is used, and the user either wants to do development to make the site fully AMP compatible (i.e. transition to AMP-first), or simply wants a simpler setup.

If at any time the active theme is switched to be the same as the one selected for Reader mode, then the plugin automatically switches from Reader mode to Transitional mode. This is because the site now will behave as if Transitional mode was selected since Reader mode involves two separate themes being used.

The paired browsing feature of the plugin remains limited to sites in Transitional mode, as it doesn't make much sense to see the AMP and non-AMP versions side-by-side if two different themes are being used.

When serving an AMP page with the theme selected in the new Reader mode (i.e. non Legacy), all of the standard WordPress theme hooks are used to extend the templates. So to add something to the footer, use the wp_footer action instead of amp_post_template_footer. Actions prefixed with amp_post_template_* are limited to the legacy Reader theme templates. To know which version should be used in a given site, use current_theme_supports('amp') which will return true if an AMP page must be served without the legacy theme.

AMP Customizer for Reader Mode

When a Reader theme is selected, there will then be two versions of the Customizer available: the default Customizer for the active theme, and the AMP Customizer for the AMP Reader theme. Since in Standard and Transitional modes only one theme is used, only one version of the Customizer will be used. The AMP Customizer can be accessed via the Customize link in the admin bar on an AMP page, or via the admin menu, or via the AMP settings screen. The fact the Customizer is currently editing the AMP version of the site is clearly displayed, along with a link to switch to the main non-AMP Customizer. The AMP Customizer opens with the “Tablet” device being selected for preview by default; this viewport corresponds to the screen size of modern smartphones and it doesn't make sense to default to preview the Desktop viewport size since the vast majority of visitors to AMP pages will be on mobile devices when Reader mode (or Transitional mode) is enabled.

In the AMP Customizer, you can assign the same nav menus used in your active theme to nav menu locations used in the Reader theme. As of #5039 there will also be the ability to copy the theme modifications from the active theme over to the Reader theme so you can preview and tweak how the logo, background color, header, and other settings look in the Reader theme prior to publishing. Any Customizer control for general site options (like the Site Title) include a notification indicating they also apply to the non-AMP version of the site. The Additional CSS section of the Customizer allows you to tweak the styles of the Reader theme separately from the Additional CSS modifying the styles of the active theme. Note that widgets are not supported on AMP pages with a Reader theme, so the Widgets panel of the AMP Customizer is removed. The Homepage Settings section is also removed since it exclusively contains global site options that are not specific to the AMP version of the site. The Themes panel is also removed in the AMP Customizer; switching Reader themes currently must be done from the AMP settings screen.

When the “Legacy” Reader theme is selected, there is only a single version of the Customizer is available; the AMP panel in the Customizer here remains for making changes to the appearance of the legacy post templates.

Non-AMP Customizer AMP Customizer for Reader theme
Non-AMP Customizer AMP Customizer

Initialization in Reader Mode

When a Reader theme is selected, a request for an AMP page will cause the Reader theme to be loaded instead of the active theme. This is using the same logic the Customizer uses to switch themes during preview. An important implication of this is that if you have custom post types, taxonomies, blocks, or shortcodes—these must be registered in plugins instead of your theme in order for them to be available on AMP pages. It is already a best practice to do such registration in plugins, but WordPress does not enforce it. The plugin will soon also provide a theme scanning capability which will detect whether the active theme is doing any such registrations in order to warn you before activating a Reader theme (see #4795).

Loading a Reader theme on an AMP request happens at the plugins_loaded action (at priority 9). The Reader theme is loaded this early to ensure it can be accessed in the Customizer and that all of the theme's functionality can be initialized properly. If you customize the query param used for AMP URLs to be different from the default of amp (via the amp_query_var filter) then you must do this in a plugin before this plugins_loaded action occurs. Otherwise, you will not be able to select a Reader theme other than Legacy. Reader themes require the use of a URL query param (e.g. ?amp=1) as opposed to an endpoint (e.g. /amp/), though we intend to improve the customization of this in the future (see #2204).

Adding Reader Themes

By default any of the core themes may be selected for Reader mode (except for the non-responsive Twenty Ten). The plugin will likely add more AMP-compatible ecosystem themes to the default list in the future, but if you'd like to include a custom AMP-compatible theme to the list there is a filter to do so, for example:

add_filter( 'amp_reader_themes', function ( $reader_themes ) {
	$reader_themes[] = [
		'name' => 'Neve',
		'slug' => 'neve',
		'preview_url' => 'https://wp-themes.com/neve',
		'screenshot_url' => 'https://i0.wp.com/themes.svn.wordpress.org/neve/2.7.5/screenshot.png?...
Read more

1.5.5

07 Jul 18:21
f9c5145
Compare
Choose a tag to compare

This is the fifth patch release for the 1.5 branch following the v1.5.4 release. The v1.5.5 milestone includes two improvements:

  • Optimize AMP_Tag_And_Attribute_Sanitizer::get_missing_mandatory_attributes(). Based on the Blackfire analysis that @schlessera performed, this fixes a bottleneck that can increase performance generating AMP pages by 3x! #4991
  • Add amp-state to list of allowed URL protocols on amp-list. This cherry-picks a change from a spec update in #4548 which will be part of the 1.6 release. #4870, #4992

Compare code changes since 1.5.4.

Installation

Now available to install via WordPress.org.

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

To install as a Git submodule, consider 1.5.5-built.