Merge latest changes to feature branch - #2564
Conversation
… tests for edge cases
…and improve type definitions - Replace string|mixed param with native string type hint in set_description(), removing manual type check - Explicitly initialize $description = null - Combine addcslashes() calls into single expression - Add @Covers annotations to new description test methods - Import MetricArguments phpstan type and replace mixed with array<string, MetricArguments> in test param annotations
…n and improved performance.
Until now the Modern Image Formats plugin only rewrote images that flowed through `the_content` (via `wp_content_img_tag`) and featured images (via `post_thumbnail_html`). Any `<img>` built by a direct call to `wp_get_attachment_image()` — page builders, archive loops, custom templates, and many plugins — was left as the original JPEG even when WebP/AVIF sub-sizes were available. Add a new `wp_get_attachment_image` filter that dispatches to the existing rewriter pipeline: `webp_uploads_img_tag_update_mime_type()` in default mode, or `webp_uploads_wrap_image_in_picture()` when picture element output is enabled. URL-returning functions (`wp_get_attachment_image_url()`, `wp_get_attachment_image_src()`, `get_the_post_thumbnail_url()`) are intentionally left untouched, since their return values feed OG tags, RSS, JSON APIs, and other non-HTML consumers where silent format substitution is unsafe. Because `the_post_thumbnail()` routes through `wp_get_attachment_image()`, the dedicated `post_thumbnail_html` registration is now redundant and has been removed; `webp_uploads_update_featured_image()` is marked `@deprecated` but kept in place for any third-party callers. Also make `webp_uploads_wrap_image_in_picture()` idempotent so that markup flowing through both `wp_get_attachment_image` and `wp_content_img_tag` isn't double-wrapped, and extend the context whitelist to include the new `wp_get_attachment_image` context. Fixes #523.
…tests Subsequent test fixtures uploading leaves.jpg get renamed to leaves-NN.jpg when leftover files remain on disk, which made the 'leaves.jpg' substring assertion fail in CI. Match on '.jpg' instead — combined with the existing '.webp' negative assertion, the intent (original format preserved) is still verified.
Featured images are now rewritten through the wp_get_attachment_image filter (via webp_uploads_filter_wp_get_attachment_image()), making this function obsolete. Document the removal as a breaking change in the changelog for third-party callers, who should switch to webp_uploads_img_tag_update_mime_type() or webp_uploads_wrap_image_in_picture() directly, or rely on the new wp_get_attachment_image filter.
In perflab_aea_get_asset_size(), two cases that should have been
treated as errors were silently passing the audit:
- A 200 response with an empty body now returns WP_Error('zero_size').
An asset that returns nothing is effectively broken, regardless of the
status code.
- A 200 response with Cache-Control: no-store now returns
WP_Error('not_cacheable'). An asset that browsers are forbidden from
caching is a clear performance problem and should surface in the audit.
Cache-Control: no-cache (revalidate) is intentionally left as passing
since the asset can still be served from cache after revalidation.
Both cases were already noted as TODOs in the original code. Removes
those TODO comments and adds tests covering zero-size, no-store,
no-cache (should pass), and normal cacheable responses. Also updates
the mock class to pass response headers through so header-dependent
tests can work end-to-end.
Fixes #2417.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a brief note with a link to the plugin FAQ on WordPress.org in the Modern Image Formats settings section on Settings > Media. Users frequently open support topics confused about why uploads aren't generating AVIF/WebP files — the FAQ already explains the common reason (converted file discarded when larger than original), so the settings UI now points there rather than duplicating the text. Fixes #2442. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
wp_remote_retrieve_header() returns string|array (array when the same header appears multiple times in the response). Joining array values with implode() before passing to strtolower() resolves the PHPStan error and also correctly handles multi-value Cache-Control headers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ted shim PR #2451 removed the public function webp_uploads_update_featured_image() outright. It was hooked on `post_thumbnail_html` and is documented `@since 1.0.0`, so deleting it without a deprecation cycle fatal-errors any third-party code that still calls it directly. Restore it in deprecated.php as a thin wrapper that emits a deprecation notice via _deprecated_function() and delegates to the current pipeline (webp_uploads_wrap_image_in_picture() / webp_uploads_img_tag_update_mime_type()). It is no longer registered as a `post_thumbnail_html` filter -- featured images are handled by the new `wp_get_attachment_image` filter -- so this restores backward compatibility without double-processing. readme.txt: move the entry from "Breaking Changes" to "Deprecated". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two robustness fixes to webp_uploads_wrap_image_in_picture().
Nested <picture> (invalid HTML)
------------------------------
When a <picture> produced for a wp_get_attachment_image() call is embedded
in post content, wp_filter_content_tags() extracts the inner <img> and runs
it back through this function via `wp_content_img_tag`. The existing
`stripos( $image, '<picture' )` guard never sees the wrapper, because only
the bare inner <img> substring is passed -- so the image is wrapped twice,
producing nested <picture><picture>...</picture></picture>.
The inner <img> is now tagged with a `data-wp-picture-wrapped` attribute,
and the idempotency guard bails when that marker is present. Context
detection (doing_filter('the_content')) was considered but rejected: it
would skip page-builder images that render during `the_content`. The marker
is documented in the readme changelog.
Empty <picture> wrapper
-----------------------
When no modern-format source resolves for an attachment, the function still
emitted `<picture><img></picture>` with no <source> children. It now returns
the original <img> when $picture_sources is empty.
Adds three tests: a regression test for the in-content double-wrap (embed in
content, run `the_content`, assert exactly one <picture>), an empty-wrapper
test, and a test for the deprecated webp_uploads_update_featured_image() shim.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ze check Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ings_fields Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
….e.x.t version Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This reverts commit 56c61e6. That commit was a temporary workaround for a wp-env URL-source download bug exposed by Node.js 24.16 in the ubuntu-24.04 runner image. It inlined the steps from wordpress/plugin-check-action so we could omit the URL plugin entry from .wp-env.json (the trigger) and install plugin-check via wp-cli post-boot, plus pinned @wordpress/env to 11.7.0. This restores the simpler `uses: wordpress/plugin-check-action@…` setup. Should only be merged after the upstream tickets referenced in the PR description are resolved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…get-attachment-image # Conflicts: # plugins/webp-uploads/tests/test-load.php
Co-authored-by: Weston Ruter <westonruter@gmail.com>
…match The idempotency guard in webp_uploads_wrap_image_in_picture() matched the raw `<picture` and `data-wp-picture-wrapped` strings anywhere in the markup, so a literal occurrence inside an attribute value (such as alt text) could falsely flag an image as already wrapped and skip the rewrite. Parse the markup with WP_HTML_Tag_Processor instead and check the actual tag name and the inner img's data-wp-picture-wrapped attribute.
Co-authored-by: Weston Ruter <westonruter@gmail.com>
…sed in 1.0.0-beta3
Limit the readme command to plugins with an open, dated release milestone (matching bump-versions and since), and add an --all flag to force the previous "update every plugin" behavior. Rework the changelog update so re-running merges only new pull requests into the existing entry, deduped by PR number, instead of wrapping prior content in an "Other" section. Also handle the empty changelog entry left by bump-versions, which previously fell through to inserting a duplicate section. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add *.min.js and *.min.css to the rsync excludes in generate-pending-release-diffs.sh so the generated svn status/diff overview omits build-derived minified files. Because rsync runs with --delete, the excludes also protect the stable copies from removal, keeping them out of the diff entirely. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Prepare 2026-06-30 release
Post 2026-06-30 release merge
Bumps [actions/cache](https://github.com/actions/cache) from 5.0.5 to 6.1.0. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@27d5ce7...55cc834) --- updated-dependencies: - dependency-name: actions/cache dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](softprops/action-gh-release@b430933...718ea10) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-version: 3.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps the wordpress-packages group with 4 updates: [@wordpress/e2e-test-utils-playwright](https://github.com/WordPress/gutenberg/tree/HEAD/packages/e2e-test-utils-playwright), [@wordpress/env](https://github.com/WordPress/gutenberg/tree/HEAD/packages/env), [@wordpress/prettier-config](https://github.com/WordPress/gutenberg/tree/HEAD/packages/prettier-config) and [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts). Updates `@wordpress/e2e-test-utils-playwright` from 1.48.1 to 1.49.0 - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-test-utils-playwright/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/e2e-test-utils-playwright@1.49.0/packages/e2e-test-utils-playwright) Updates `@wordpress/env` from 11.8.1 to 11.9.0 - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/env/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/env@11.9.0/packages/env) Updates `@wordpress/prettier-config` from 4.48.1 to 4.49.0 - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/prettier-config/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/prettier-config@4.49.0/packages/prettier-config) Updates `@wordpress/scripts` from 32.4.1 to 32.5.0 - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@32.5.0/packages/scripts) --- updated-dependencies: - dependency-name: "@wordpress/e2e-test-utils-playwright" dependency-version: 1.49.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: wordpress-packages - dependency-name: "@wordpress/env" dependency-version: 11.9.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: wordpress-packages - dependency-name: "@wordpress/prettier-config" dependency-version: 4.49.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: wordpress-packages - dependency-name: "@wordpress/scripts" dependency-version: 32.5.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: wordpress-packages ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [lint-staged](https://github.com/lint-staged/lint-staged) from 17.0.7 to 17.0.8. - [Release notes](https://github.com/lint-staged/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/main/CHANGELOG.md) - [Commits](lint-staged/lint-staged@v17.0.7...v17.0.8) --- updated-dependencies: - dependency-name: lint-staged dependency-version: 17.0.8 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [@playwright/test](https://github.com/microsoft/playwright) from 1.61.0 to 1.61.1. - [Release notes](https://github.com/microsoft/playwright/releases) - [Commits](microsoft/playwright@v1.61.0...v1.61.1) --- updated-dependencies: - dependency-name: "@playwright/test" dependency-version: 1.61.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [globals](https://github.com/sindresorhus/globals) from 17.6.0 to 17.7.0. - [Release notes](https://github.com/sindresorhus/globals/releases) - [Commits](sindresorhus/globals@v17.6.0...v17.7.0) --- updated-dependencies: - dependency-name: globals dependency-version: 17.7.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
…ls-17.7.0 Bump globals from 17.6.0 to 17.7.0
…staged-17.0.8 Bump lint-staged from 17.0.7 to 17.0.8
…right/test-1.61.1 Bump @playwright/test from 1.61.0 to 1.61.1
…ress-packages-c41c88fc72 Bump the wordpress-packages group with 4 updates
…ions/cache-6.1.0 Bump actions/cache from 5.0.5 to 6.1.0
…tprops/action-gh-release-3.0.1 Bump softprops/action-gh-release from 3.0.0 to 3.0.1
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feature/2449-gallery-block #2564 +/- ##
==============================================================
+ Coverage 69.29% 70.38% +1.08%
==============================================================
Files 90 91 +1
Lines 7723 7850 +127
==============================================================
+ Hits 5352 5525 +173
+ Misses 2371 2325 -46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Get the latest change from trunk.
Relevant technical choices
Use of AI Tools