Releases: ampproject/amp-wp
2.2.4
Following up on the 2.2.2 (and 2.2.3) release from last week, this 2.2.4 milestone addresses a regression in the handling of hero images on optimized AMP pages, specifically when the data-hero
attribute had been manually-supplied by a theme/plugin author.
- Restrict collection of attributes allowed on
noscript
fallback elements. (#7036) - Upgrade amp-toolbox-php to 0.11.1 to harden hero image optimization when
noscript > img
fallbacks are present (#7039, ampproject/amp-toolbox-php#516)
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.2.4-built.
2.2.3
This is a PHP 5.6 compatibility hotfix for yesterday's 2.2.2 release. There were no code changes other than regenerating the Composer autoload files on PHP 5.6 (see built diff). There was a syntax error being caused in PHP 5.6 due to Composer generating syntax that requires PHP 7+. See #7030.
👉 Note: The next AMP plugin version will likely increase the minimum PHP version to 7 since only 6.6% of WordPress installs are currently on PHP 5.6, which is also a legacy PHP version that is no longer maintained and is much slower than PHP 7 (or PHP 8).
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.2.3-built.
2.2.2
This is a maintenance release, following up on 2.2.1 from 2 months ago. For the full list of issues and pull requests in this release, please see the 2.2.2 milestone with 25 closed issues and 35 merged pull requests (minus dependency updates). See full diff of changes.
Changelog
Sanitization & Conversion
- Allow native
img
without any PX-verified exemptions. In the subsequent 2.3 release images will no longer be converted toamp-img
/amp-anim
by default and nativeimg
will be used instead (per #6805). (#6803) - Reduce length of specificity-hacked CSS selectors and fix CSS selector conversion to work properly with
amp-next-page
. (#6909, #6312) - Prevent removal of entire
picture
element tree when sanitizing by promoting child fallbackimg
in conversion toamp-img
; add sanitizer argument to retainpicture
as PX-verified. (#6676, #6896) - Replace
img
withamp-pixel
instead ofamp-img
when sanitizing the Facebook tracking pixel. (#6059, #6965) - Disable auto-lightbox by default. (#5122, #6936)
- Update amphtml validator spec to 2202230359001. (#6956, #6803)
- Remove obsolete code that strips whitespace around equal signs from meta viewport. (#4742, #6979)
Embeds
- Improve handling of WordPress post embeds by utilizing
amp-wordpress-embed
. (#809, #6665) - Update
gallery
shortcode embed handler to account for no shortcode attributes (improving PHP 8 compat). (#6939)
Admin
- Show validation issues for plugins and themes on AMP setting page after completion of Site Scan; allow copying of issues to clipboard to be shared with theme/plugin authors even when user has DevTools turned off. (#6807, #6835, #7013, #7015)
- Do async site scanning after theme activation. (#6814, #6859)
- Add dropdown to select vendors when managing analytics entries. (#6367, #6894)
- Add plugin suppression indication on plugins list table. (#5340, #6959)
- Immediately add or remove DevTools-related AMP admin menu items when toggling setting. (#6714, #6878)
- Improve determination of eligible post types for AMP. (#6883, #6897)
- Add margins to buttons on Settings screen. (#7001, #7010)
- Prevent duplication of script for hiding admin bar in onboarding wizard. (#6643, #6877)
- Parent theme with AMP incompatibilities is greyed-out in the Site Scan results. (#6958, #6859)
Testing
- Add E2E tests for the nav menu toggles and search UI on core themes. (#5404, #6967, #6933)
- Bump stable PHP version used in CI and update unit tests to utilize Yoast/wp-test-utils v1.0. (#6466)
- Fix phpunit tests after postcss update and changes in WP 6.0-alpha. (#6983)
Core Compat
- Use
wp_unique_id()
-based block class names instead ofuniqid()
and reset the disabling of CSS transient caching in affected versions of WordPress/Gutenberg. (#6925, #6949, #7004) - Add support for dark mode user toggle in Twenty Twenty-One. (#6783, #6874)
- Re-insert AMP Preview button whenever editor toolbar changes to ensure button shows up initially in WP 5.6, 5.7, and 5.8. (#6893, #6900)
- Fix color and position of captions in carousel galleries when links are present. (#6734, #6907)
PHP 8 Compat
- Harden against possibility of 'Undefined array key url' warning for PHP 8.0. (#6921, #6948)
- Fix Site Health check for page caching to account for
wp_remote_retrieve_header()
returning arrays when duplicate response headers are present. (#6937, #6938) - Improve checks for image dimensions extraction to avoid possibility of division by zero. (#6968, #6973)
Infrastructure
- Prevent copying PHP files from
src/
intoassets/
. (#6947, #6952, #6955) - Attempt to fix Dependabot auto-merge workflow. (#6975, #6964)
Props
Alain Schlesser (@schlessera), Alberto Medina (@amedina), Bartosz Gadomski (@bartoszgadomski), Daniel Rueda (@danirueda), Dhaval Parekh (@dhaval-parekh), Edi Amin (@ediamin) Fellyph Cintra (@fellyph), James Osborne (@jamesozzie), John Watkins (@johnwatkins0), Lovekesh Kumar (@thelovekesh), Maitreyie Chavan (@maitreyie-chavan), Milind More (@milindmore22), Nikhil Joshua (@NikhilJoshua), Pierre Gordon (@pierlon), Piotr Delawski (@delawski), Pooja Killekar (@pooja-muchandikar), Rutvik Savsani (@rutviksavsani), Ryan Welcher (@ryanwelcher), 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.2.2-built.
2.2.1
This is a maintenance release, following up on 2.2.0 from 2 months ago. This release improves compatibility with changes in WordPress 5.9, including block-based themes like Twenty Twenty-Two. For the full list of issues and pull requests in this release, please see the 2.2.1 milestone with 11 closed issues and 12 merged pull requests (minus dependency updates). See full diff of changes.
Changelog
- Improve logic for page cache detection in Site Health test and surface more details (#6830, #6849)
- Optimize the process of deleting AMP data during uninstallation to avoid timeouts (#6840, #6826)
- Support converting YouTube iframes with 100% width to
amp-youtube
with fixed-height layout (#6837, #6834) - Fix error in during Site Scanning in which “sources is not iterable” is raised (#6846, #6827)
- Add AMP implementation of skip link for block-based themes in Full Site Editing (#6115, #6823)
- Add support for responsive Navigation block (#6319, #6838)
- Fix AMP Lightbox and AMP Carousel for updated Gallery block format in WordPress 5.9 (#6833, #6848)
- Remove “Add lightbox effect” toggle from Image blocks nested in Gallery block as of WP 5.9 (#6832, #6833, #6871)
- Fix conflict between Plugin Suppression and AMP validation (#6809, #6812)
- Handle case in Site Scanning when no scannable URL is available (#6856, #6855)
- Fix block validation errors caused by amp-fit-text deprecation (#6872)
- Fix AMP preview button latest WordPress and Gutenberg (#6881)
- Fix test to account for
gutenberg_render_layout_support_flag()
(#6850) - Update amp-toolbox-php to 0.10.0 and update other npm and composer packages (#6824, #6886)
- Remove deprecated layout and noloading controls from editor sidebar and prevent empty “AMP Settings” panel from appearing (#6508, #6833)
Props
Alain Schlesser (@schlessera), Alberto Medina (@amedina), Bartosz Gadomski (@bartoszgadomski), Dhaval Parekh (@dhaval-parekh), Edi Amin (@ediamin), Fellyph Cintra (@fellyph), Maitreyie Chavan (@maitreyie-chavan), Milind More (@milindmore22), Pascal Birchler (@swissspidy), Pierre Gordon (@pierlon), Piotr Delawski (@delawski), 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.2.1-built.
2.2
For the full list of changes in this release, please see the 2.2 milestone, with 44 closed issues and 116 merged pull requests (minus dependency updates). Read on for the full details.
Changelog
Settings Screen and Onboarding Wizard
- Add Site Scanner to check key templates for AMP compatibility issues with plugins themes. Results inform recommendations for the template mode, plugin suppression, and trying alternative AMP-compatible themes/plugins. Site Scanning is exposed on Settings screen and Onboarding Wizard. (#4719, #6610, #6650, #6740, #6742, #6741, #6791, #6615, #6692, #6683, #6691, #6705, #6760, #6777, #6743, #6698, #6696, #6690, #6689)
- Add Site Review to final step of Onboarding Wizard to allow users to browse around key AMP-enabled URLs to verify it is working as expected. Also add a Review section to the Settings screen. (#6071, #6596)
- Integrate AMP-compatible directory of themes and plugins, highlighting the ecosystem components that are known to work well. (#2313, #6597, #6725, #6726, #6681, #6704, #6723)
- Update Settings page to include "Other" section including user-specific DevTools toggle. (#6501, #5578)
- Reduce size of UI elements on Settings screen. (#5559, #6500)
Bento & Sandboxing
Introduce experimental support for a more flexible AMP via Bento with dynamic levels of sandboxing enforcement. (See Bento introduction post on AMP Blog.) The Sandboxing experiment can be enabled when using the Standard template mode, and you may choose a minimum sandboxing level of loose, moderate, or strict.
- Strict is essentially the plugin's current behavior of removing all invalid AMP markup by default.
- Moderate means that custom scripts are removed by default (like Strict) and conversions to (Bento) AMP components will be performed, but other invalid AMP like external POST forms will be retained. (To add a custom script to a page and yet remain in Moderate, add the
data-px-verified-tag
attribute to thescript
tag.) - Loose means no invalid AMP markup will be stripped out by default, image/video/iframe/etc conversions will be skipped, and CSS tree shaking is not performed.
The sandboxing levels are dynamic, so if you select Loose but there is no invalid AMP markup on the page, it will automatically upgrade to Strict. (#6443, #6546, #6769, #5549, #6715, #6787, #6788, #6767, #6577, #6757)
- Add opt-in support for custom non-AMP scripts, where keeping a non-AMP script disables CSS tree-shaking and disables various conversions which could break the included scripts. Provide mechanism to prevent
noscript
unwrapping, and disables unwrapping whenever custom non-AMP scripts are kept. (#6030, #6528) - Add support for native
img
. This involves anative_img_used
argument on the image sanitizer which is disabled by default, but it will be enabled by default in the next release (since nativeimg
will be valid AMP). It is enabled when in the loose sandboxing level. (#6518) - Add opt-in to prevent
POST
forms from being converted toamp-form
(withaction-xhr
). This opt-in is enabled when in loose or moderate sandboxing levels. (#6527) - Add Bento opt-in via
amp_bento_enabled
filter. (#6353, #6537) - Introduce Bento sanitizer to handle with
bento
-prefixed components. (#6722) - Propagate width/height styles as width/height attributes when setting layout. (#6662)
- Use intrinsic as default layout for video instead of responsive layout. (#6761)
- Fix height of Video blocks when native
video
is used. (#6762)
Support
Add Support screen that facilitates users to submit site information privately with a submission UUID to reference in a support topic. This eliminates the need for the Google Form we were previously using. (#5939, #6147, #6627, #6604, #6652, #6764, #6707, #6718)
Site Health
- Add Site Health test for page caching (advanced cache) and recommend if not detected. (#4386, #6456)
- Prompt user to flush page cache when changing template mode or reader theme (and page caching is detected). (#4843, #6467)
- Detect available object caching backend(s) to guide users toward persistent object caching plugins. (#5780, #6493)
Embeds
- Persist YouTube URL parameters when converting to
amp-youtube
, including the seek time. (#4518, #6423) - Add overflow buttons to Twitter, Facebook, and Instagram embeds. This is necessary since the Bento components no longer cause layout shifts if they need to resize. (#6502)
- Update
amp-twitter
to usefixed-height
layout with a default height matching minimal tweet height. (#6504, #6510)
CSS
- Provide ability to bypass conversion of inline style attributes and
!important
qualifiers via newtransform_important_qualifiers
argument to style sanitizer. (#6295, #6589) - Prevent completely tree-shaken styles from triggering excessive CSS. (#6624)
- Mark
amp-story-captions
as element containing dynamic content. (#6628) - Fix prioritization of TT1 stylesheet after core theme sanitizer changes. (#6625)
Images
- Avoid fetching image dimensions over HTTP when images are on the filesystem. (#5115, #6448)
- Eliminate static emoji handling since most browsers now support natively. (#6717)
Validation
- Do asynchronous Site Scan upon plugin activation and show results in admin notice on plugins screen. This eliminates plugin activation latency caused by previously doing synchronous validation of just the homepage. (#5101, #6685, #6758)
- Re-validate site URLs used for Site Scanning in weekly scheduled task. (#5750, #6520)
- Add garbage collection for stale and redundant validation data. (#4779, #6763)
- Add validation error source attribution for script translations and
wp_editor()
(#4750, #6670, #6668) - Track assets those registered or enqueued in block's render callback to prevent erroneous attribution. (#6579, #5411, #6231)
- Update amphtml spec to 2111242025000. (#6651, #6697, #6712, #6752)
- Ignore WordPress core as a source when there is a theme/plugin error source in block editor AMP sidebar. Errors emitted by
core/shortcode
will no longer be blamed on WordPress core. (#6667, #6675) - Improve displaying of unreviewed counts for Validated URLs and Validation Errors to reduce the loading flash with each page load. (#6765, #6770)
- Fix selection of Reader theme causing validated URLs to always be stale. (#6779)
- Mark scripts output by
wp_comment_form_unfiltered_html_nonce()
andwp_post_preview_js()
as being in AMP Dev Mode so they are not sanitized; they only appear when logged-in and they are don't negatively impact PX. (#6680)
WP Core Compatibility
- Improve page experience for fonts in core themes with
preload
links andfont-display
. (#6036, #6674) - Fix backwards compatibility with older versions of WP by fixing polyfills, gracefully degrading, and omitting certain features. (#6773, #6775, #6789, #6776, #6782)
- Mark wp-polyfill as an AMP Dev Mode script for Paired Browsing. (#6721)
- Implement WP 5.9 change to remove empty query string when removing endpoint from a URL that contains a URL fragment. (#6727)
- Fix test in WP 5.9-beta1: Cast term IDs to integers instead of using
sanitize_key()
. (#6754)
Uninstallation
Remove plugin-specific data at plugin uninstallation. A new toggle on the settings screen allows uninstall without AMP data removal. (#3210, #6422, #6486, #6632)
Misc
- Eliminate
amphtml
AMP-to-AMP linking attribute from links to fix broken structure data. (#6599, #6661) - Add robots noindexing to PWA service worker install page. (#6669)
- Update amp-toolbox-php from 0.6.0 to to 0.8.3. (#6498, #6551, #6567, #6568, #6657, #6768, #6792)
Infrastructure & Testing
- Ensure services that are delayed and have requirements are scheduled correctly. (#6548, #6529)
- Allow for required GHA job statuses to be reported so that all PR checks have a status. (#6378, #6393)
- Make E2E environment setup more robust; add GHA reporter for E2E and JS unit tests. (#6280)
- Trigger CI jobs when a dependency file is modified. (#6400)
- Add GitHub action to auto-merge Dependabot pull requests and combine Gutenberg dependency updates in a single PR. (#6298, #6302, #6347, #6380, #6401, #6478, #6349, #6379, #6439)
- Change time dependabot creates PRs. (#6482)
- Add CODEOWNERS. (#6296)
- Fix phpstan v0.12.99 static analysis failures. (#6600)
- Update phpstan config for 1.0.0. (#6673)
- Remove empty scripts after webpack compilation. (#6778, #6780)
- Add LGTM code analysis. (#6587, #6608)
- Add CodeQL GHA to find potential security vulnerabilities. (#6591)
- Ensure only a single instance of a workflow using the same concurrency group will run at a time. (#6592)
- Fix and modernize E2E tests. (#6613, #6620, #6747, #6751)
- Update svgo Babel config. (#6562)
- Migrate QA plugin to separate repo. (#6427)
- Convert issue templates into issue forms. (#6543)
Tech Debt
- Fix default arg and actual arg key mismatch in comment sanitizer. (#4624)
- Use class constants instead of classes as string literals. (#6545)
- Remove obsolete
include_layout_in_wp_kses_allowed_html
. (#6572) - Remove obsolete (and unused)
SavePostValidationEvent
. (#6771)
Props
Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:
Adam Silverstein (@adamsilverstein), Alain Schlesser (@schlessera), Alberto Medina (@amedina), Bartosz Gadomski (@bartoszgadomski), Bethany Chobanian Lang (@bethanylang), Dhaval Parekh (@dhaval-parekh), Edi Amin (@ed...
2.1.4
This is a maintenance release, following up on 2.1.3 from 2 months ago. (Work is ongoing for the 2.2 release which is due out the end of September.) For the full list of issues and pull requests in this release, please see the 2.1.4 milestone with 11 closed issues and 36 merged pull requests. See full diff of changes.
Changelog
Validation
- Update AMP validator spec. (#6436, #6530, #6532)
- Permit the
amp-carousel
script to be printed on page when there is justamp-lightbox-gallery
and noamp-carousel
, allowing v0.2 to be used instead of autoloading v0.1. (#6509) - Remove
muted
attribute fromamp-video
and itsvideo
fallback whenautoplay
is present, preventing AMP validation warnings from occurring. (#6581) - Remove extraneous
calc()
from media queries in Legacy theme, preventing AMP validation warnings from being reported. (#6557, #6559)
Embeds & Media
- Update the TikTok embed handler to use
amp-tiktok
component. (#6060, #6558, #6586, #6574) - Prevent videos with unknown dimensions from appearing as stretched by giving
object-fit:contain
styling (as is done for images with unknown dimensions). (#6578, #6571, #6576) - Add featured image selector to pre-publish panel to accompany notice recommending that one be set. (#6563, #6580)
- Recognize WebP images as being aligned with featured image recommendations. (#6536, #6565)
Routing
- Fix redirect loop when there are multiple spaces in the url. (#6492, #6494)
- Short-circuit
validate_url()
when attempting validation requests to other sites (which will always fail). (#6582)
Compatibility
- Fix fatal error in PHP 8. (#6505, #6506)
- Prevent
wp_enqueue_scripts()
notice from appearing on the new block-based Widgets screen. (#6521, #6534) - Fix styling issues with visually-hidden components when the latest Gutenberg is active. (#6235, #6585, #6570)
- Fix display of step icons in Onboarding Wizard sidebar in Safari. (#6490, #6496)
Infrastructure & Misc
- Fix broken Site Health test for “Transient caching of parsed stylesheets is disabled”, specifically the “Re-enable transient caching” button. (#6549, #6552)
- Fix issues with service dependencies which could prevent proper activation when using plugins like TGMPA. (#6459, #6529, #6484, #6553)
- Use built-in caching from
actions/setup-node
GHA. (#6544, #6541) - Decouple tests from external TestCase dependency. (#6539, #6538)
- Fix PHP 8 unit test GHA job. (#6533, #6525)
- Add Composer plugin to correctly autoload PHP CSS Parser dependency. (#6472, #6464)
- Fix test failure in WP 5.8. (#6468)
- Update Composer dependencies. (#6447)
- Update JS test snapshots. (#6575)
Props
Alain Schlesser (@schlessera), Alberto Medina (@amedina), @arthur791004, Dhaval Parekh (@dhaval-parekh), Joshua Wold (@jwold), @ktmn, Maitreyie Chavan (@maitreyie-chavan), Milind More (@milindmore22), Pascal Birchler (@swissspidy), Pierre Gordon (@pierlon), Piotr Delawski (@delawski), Roland Farkas (@rolandfarkasCOM), Thrijith Thankachan (@thrijith), 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.1.4-built.
2.1.3
This 2.1.3 release follows up on 2.1.2 from 6 weeks ago. The key improvements in this release revolve around the Optimizer, paired URL routing, frontend/backend error handling, support for new AMP components, and compatibility with WordPress 5.8.
For the full list of issues and pull requests in this release, please see the 2.1.3 milestone with 6 closed issues and 18 merged pull requests. See full diff of changes.
Changelog
Optimizer
- Update hero image handling to remove max count. Now when there is a custom logo, header image, and featured image they can all be prerendered in order to reduce LCP. Previously only the first two would only ever be prerendered. (#6435)
- Ensure site icon in legacy template is identified as a hero image. (#6403)
- Update
amp-toolbox-php
to v0.6.0. This includes SSR support forfluid
layout, disablinglink[rel=modulepreload]
on SSR'ed pages (to improve performance), improves handling of resource hints, among other changes. - Ensure first entry content in
DetermineHeroImages
matches.amp-wp-article-content
in legacy Reader templates. (#6440)
Routing
- Fix construction of comment page URLs when a path suffix is used in the paired URL structure. (#6355, #6389)
- Indicate what entity(s) are blocking the use of the path suffix and legacy reader paired URL structures. (#6339, #6374, #6396)
Error Handling
- Update error page to support fatal errors (in PHP 7+). (#6421)
- Add JS error handling to Settings page and Onboarding Wizard, including error screens for dependency load failures and JavaScript being disabled. (#6230, #6320)
Validation
- Update amphtml spec to 2106240350000. Newly supported components include
amp-render
,amp-iframely
, andamp-stream-gallery
. (#6303, #6425) - Update means of determining Bento support for components. (#6373)
WordPress 5.8 Compatibility
- Add
data-ampdevmode
attribute toregenerator-runtime
script when enqueuing Paired Browsing scripts. This fixes a validation issue on WordPress 5.8. (#6416, #6419) - Fix
test_get_mu_plugins_data
for WP 5.8. (#6434) - Fix
test_amp_get_schemaorg_metadata
andtest_wrap_widget_callbacks
in Gutenberg v10.8 and WP 5.8. (#6366)
Misc
- Update class name used to display a pending state when retrieving validation counts, preventing conflicts with other plugins that use the same class name. (#6398)
- Fix incorrect usage of
mysql2date()
to generatedatePublished
anddateModified
in Schema.org metadata, causing bug in time offsets. (#6316, #6318) - Fix incorrect use of
_n()
in /src/admin/site-health.php. (#6305, #6306) - Update codecov GitHub Action. (#6397)
Props
Alain Schlesser (@schlessera), Alberto Medina (@amedina), Dhaval Parekh (@dhaval-parekh), Evan Mattson (@aaemnnosttv), Francesco (@DrLightman), Joshua Wold (@jwold), Pascal Birchler (@swissspidy), Pierre Gordon (@pierlon), Piotr Delawski (@delawski), Tor-Björn Fjellner (@tobifjellner), 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.1.3-built.
2.1.2
This 2.1.2 release follows up on 2.1.1 from 10 days ago, fixing bugs reported by a few users and making a couple enhancements.
For the full list of issues and pull requests in this release, please see the 2.1.2 milestone with 3 closed issues and 12 merged pull requests. See full diff of changes.
Changelog
- Clarify what Paired URL Structures are and when to change them. (#6227, #6229)
- Account for recursive request parsing in
PairedRouting
, fixing compatibility with the Custom Permalinks. (#6197) - Prevent fatal error in
HeroCandidateFiltering
when attachment post is not available. (#6256) - Defer obtaining URL for Customizer preview until AMP Customizer is accessed to improve WP Admin performance in Reader mode. (#6198)
- Always provide polyfill for dependencies if WP or Gutenberg plugin is not supported. Ensure onboarding wizard works on WP<5.6. Fixes WP 4.9 + Gutenberg:
Uncaught TypeError: Object(...) is not a function
on settings page. (#6194, #6225) - Bump editor support minimum requirements to prevent errors on post editor in WP<5.6. (#6236, #6193)
- Avoid possibility of
ob_start()
being called during output buffer processing to avoid fatal error. Theamp_get_schemaorg_metadata()
function is now called attemplate_redirect
before output buffer processing. (#6232, #6233) - Show HTTP error code when failing to fetch. (#6255)
- Use last PR commit hash for plugin version code and add query param to cache bust plugin build downloads. (#6259)
- Fix
lint-js
job failure for dependabot PRs. (#6253) - Fix dependabot username in GHA workflows. (#6254)
Props
Alain Schlesser (@schlessera), Alberto A. Medina (@amedina), Evan Mattson (@aaemnnosttv), Joshua Wold (@jwold), @nbcsteveb, Pierre Gordon (@pierlon), Piotr Delawski (@delawski), 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.1.2-built.
2.1.1
This release follows up on 2.1.0, fixing a couple issues reported since yesterday.
For the full list of issues and pull requests in this release, please see the 2.1.1 milestone with 3 merged pull requests. See full diff of changes.
Changelog
- Prevent fatal error when another plugin disables AMP via the
amp_is_enabled
filter but then later it or another plugin/theme tries to callis_amp_endpoint()
/amp_is_request()
. A_doing_it_wrong()
notice is emitted instead of an exception being thrown. (#6181, #6184) - Fix incorrect count of unreviewed Validation URLs in in admin menu item. (#6185)
Props
Alain Schlesser (@schlessera), Milind More (@milindmore22), 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.1.1-built.
2.1
Some key features in this release include:
- Customizable Paired URL Structures: For paired AMP sites (using Reader or Transitional template modes) you can finally customize the paired AMP URLs, including using
/amp/
,?amp=1
,?amp
, or even a completely custom URL scheme. - Redesigned AMP Validation in Block Editor: Validation errors in the block editor are now much less obtrusive as they now appear in a sidebar in the block editor. Additionally, validation now happens asynchronously which greatly speeds up saving with DevTools enabled.
- Hero Image Prerendering: Hero images (like custom logo, header image, and featured image) are identified on the page and they will now get prerendered (skipping lazy-loading) to ensure they do not negatively impact the Largest Contentful Paint (LCP) metric in Core Web Vitals (CWV).
- Serving AMP scripts as ES modules to modern browsers: To reduce the amount of JavaScript that is served to visitors, modern browsers will now be served
module
scripts.
For the full list of changes in this release, please see the 2.1 milestone, with 55 closed issues and 98 merged pull requests (minus dependency updates). Read on for the full details.
Changelog
Routing
- Customizable Paired URL Structures: One of the most frequent requests we've received over the years is to have more control over the structure of paired AMP URLs. (Remember that paired URLs only apply to Transitional/Reader template modes since Standard template mode is AMP-first in that the canonical URLs themselves are AMP.) Historically, the
/amp/
URL endpoint was limited to single post URLs in Reader mode for the legacy post templates, whereas the?amp
query param was used for pages and all URLs in Transitional mode and any AMP page using a Reader theme. These restrictions have been lifted, so now you can use any paired URL structure you like regardless of whether you're in Transitional or Reader mode and irrespective of the template being viewed. By default the?amp=1
query param is used as the paired URL structure for new installs, but you can also use the/amp/
endpoint suffix for all paired URLs. You can even implement a totally custom structure, such as a subdomain or using a path prefix. When switching from/amp/
to?amp=1
, redirects will prevent 404s. (#2204, #5558, #4312, #5861, #5862, #2062, #3357, #4442, #5804)
- Improved support for late-defined AMP slugs. If you happen to change the AMP slug (query var) from the default
amp
to something else likelite
, you can do so either via theamp_query_var
filter or via the (deprecated)AMP_QUERY_VAR
constant. In early versions of the AMP plugin, this customization was commonly done in the theme. However, this happens much too late for the AMP plugin to be able to switch to a Reader theme or now to properly route paired AMP requests. Instead of limiting the user to the AMP Legacy theme and the?amp=1
paired URL structure, when the query var is defined late it is now cached in an option so that it can be made available early in WordPress's execution (atplugins_loaded
). Since such late-defined slugs are still not ideal, a new Site Health check will recommend that you move it from the theme to a plugin. (#6125, #5789, #5859)
Validation and Developer Tools
- Visual refresh of validation screens. The way to represent “unreviewed” validation errors has changed. Instead of being styled like unmoderated comments with an orange background, they now appear with bolded text and a white background. In contrast, reviewed errors get a gray background and unbolded text. In this way, they are styled similarly to unread/read messages in an email client. When the invalid markup causing a validation error is kept, then the error gets a red left border. This new design language is carried throughout all the validation screens as well as the new AMP Validation sidebar in the block editor. (#5995, #6067)
- Fix incorrect title for admin bar menu item when dev tools is disabled and on an AMP page. #6124, #6126
- Copying Validation Errors to Clipboard: When on the Validated URL screen, you can now copy to the clipboard the full JSON data for a validation error or all validation errors for a URL. This should greatly facilitate getting support. (#5209, #5500, #5825, #5835)
- Show error when attempting to validate an AMP-unavailable URL instead of forcing AMP to be available. (#5295, #5296)
- Asynchronously populate counts for unreviewed validation errors and validated URLs in admin menu and dashboard widget. (#5772, #5900, #6120, #6122)
- Optimize method of stripping validation response of affixed HTML comments. (#6011, #6021)
- Prevent paired browsing client script from being sanitized. (#6099)
- Avoid failing validation requests when response is redirect. (#6069)
- Use WP Cron to periodically check site URLs for AMP validation, but move behind feature flag filter until Site Scanning is implemented. (#1756, #5515, #5228, #5892)
- URL validation CLI script contains logic that should be made available outside the CLI script. (#5307, #5306)
Editor
- Redesigned AMP Validation in Block Editor: Checking for validation issues is no longer performed synchronously during post updates, greatly speeding up the save process. When AMP validation errors are reported in the editor, previously they were displayed as inline warning notices with each block which had an AMP validation error. This was obtrusive and it could break the layout of nested blocks. These inline warnings have been eliminated in favor of showing all the validation information in an AMP Validation sidebar in the editor. A block toolbar button indicates when there is an error and provides a shortcut to open the sidebar. The validation errors in the sidebar provide much more information than the inline notices previously did, including the theme/plugin responsible for the error. (#3821, #5589, #3673, #5929, #2069, #5741, #5304, #5887, #5870)
Before | After |
---|---|
![]() |
![]() |
- Introduce AMP status panel to document sidebar and pre-publish checks. To improve visibility of AMP validation issues in the block editor when developer tools are enabled, the “Enable AMP” toggle has been moved to a new AMP panel in the document sidebar. This panel now includes the validation status message and a button to take you to the AMP Validation sidebar. This same panel is also now presented in the pre-publish checks. (#5997, #6027, #6022)
Before | After |
---|---|
![]() |
![]() |
- Eliminate AMP validation from Classic Editor. (#5996)
- Make parameters to Gutenberg filter callbacks more robust to prevent possible JS error when media library is being filtered. (#5866)
Optimizer
- Hero Image Prerendering: To reduce the Largest Contentful Paint (LCP) metric, the AMP Optimizer now prerenders hero image(s). It will automatically identify heroes from images in the header (including custom logo and header image) as well as the featured image and first content image. When the automatic hero image determination doesn't get it right, you can supply a
data-hero-candidate
attribute to inform the Optimizer which images should also be identified as heroes for prerendering. Note that currently only the first two images withdata-hero-candidate
will be prerendered (but see ampproject/amp-toolbox-php#55 (comment)). If you supply thedata-hero
attribute on any image, then the Optimizer will disregard any images that have been marked withdata-hero-candidate
. (#5055, #5350, #5824, #5923, #5934, #6168, #6062, #6061, ampproject/amp-toolbox-php#141, ampproject/amp-toolbox-php#149, ampproject/amp-toolbox-php#144, ampproject/amp-toolbox-php#141, ampproject/amp-toolbox-php#136, ampproject/amp-toolbox-php#135, ampproject/amp-toolbox-php#115, #6111, #5823) - Serve AMP scripts as ES modules to modern browsers. The
RewriteAmpUrls
optimizer transformer was ported to amp-toolbox-php. This transformer rewrites AMPscript
tags to usetype=module
for supporting browsers. These scripts are comprised of ES modules which reduce the overall amount of code since polyfills for older browsers are omitted. Support for older browsers remains by serving the original AMP scripts withnomodule
. This transformer also allows opting-in to the LTS versions of AMP scripts (cf. #4600). Additional changes will facilitate script self-hosting in a future release. (#6037, ampproject/amp-toolbox-php#140, https:...