Skip to content

Add explanation notice for modern image format settings#2443

Open
reverb256 wants to merge 2 commits intoWordPress:trunkfrom
reverb256:fix/2442-modern-image-explanation
Open

Add explanation notice for modern image format settings#2443
reverb256 wants to merge 2 commits intoWordPress:trunkfrom
reverb256:fix/2442-modern-image-explanation

Conversation

@reverb256
Copy link
Copy Markdown

Summary

Fixes #2442

Users frequently open support topics confused about why their uploads aren't generating AVIF/WebP files. The plugin discards converted files if they're larger than the original (webp_uploads_discard_larger_generated_images defaults to true), but there was no explanation in the admin dashboard.

Changes

  • Replaced __return_empty_string section callback with webp_uploads_render_settings_section_info() which renders an informational notice in the Modern Image Formats settings section
  • The notice explains why modern format images may not always be generated
  • Links to the existing plugin FAQ on wordpress.org for full details
  • Follows the existing notice notice-info inline pattern used in other setting callbacks in this file

Screenshots

The notice appears at the top of the Modern Image Formats settings section, before the output format dropdown:

ℹ️ Modern image formats (e.g. WebP, AVIF) are only generated when they result in a smaller file than the original. If a converted image would be larger, the original is kept instead. For more details, see the FAQ.

Testing

  • php -l — no syntax errors
  • phpcs --standard=WordPress-Core — zero violations
  • phpstan analyse — no errors

AI Disclosure

AI tooling (Claude) was used to assist with code generation and analysis. The code was reviewed, tested, and validated manually.

Users frequently open support topics confused about why their uploads
aren't generating AVIF/WebP files. The plugin discards converted files
that are larger than the original (default behavior).

This adds an informational notice to the Modern Image Formats settings
section that explains this behavior and links to the plugin FAQ.

Uses existing notice notice-info inline pattern from other callbacks.

Fixes WordPress#2442
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

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 props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @reverb256.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: reverb256.

Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: b1ink0 <b1ink0@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 69.38%. Comparing base (61b1379) to head (adf158f).

Files with missing lines Patch % Lines
plugins/webp-uploads/settings.php 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2443      +/-   ##
==========================================
+ Coverage   69.33%   69.38%   +0.05%     
==========================================
  Files          90       90              
  Lines        7749     7762      +13     
==========================================
+ Hits         5373     5386      +13     
  Misses       2376     2376              
Flag Coverage Δ
multisite 69.38% <92.85%> (+0.05%) ⬆️
single 35.84% <92.85%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Covers webp_uploads_render_settings_section_info() which was flagged
by Codecov as 0% patch coverage.

Test asserts the info notice contains:
- notice-info CSS class
- Explanation about modern format generation
- Link to the plugin FAQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add explanation for why modern format images may not appear after upload

1 participant