Repository navigation
Conversation
The list of file types a network allows uploading (the `upload_filetypes` network option) is populated when the network is created, and is never updated when WordPress adds support for new file types. Networks created before 5.8 cannot upload WebP images, before 6.5 AVIF images, and before 6.6 most of the other types core allows on a single site. On multisite, a new Site Health test lists the file types a network created today would allow, but this network does not, as a recommendation. Types the network allows beyond those are not reported. HTML and JavaScript are never recommended. The link to Network Settings is only shown to users who can change them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a multisite Site Health check that recommends the file types a network created today would allow uploading, when the network's list is missing any of them.
The
upload_filetypesnetwork option is populated once, inpopulate_network_meta(), and upgrades never change it:webpto the defaults, and [57524] (6.5) addedavif.get_allowed_mime_types(), and notes that existing networks are not affected.So networks created before 5.8 cannot upload WebP, those created before 6.5 cannot upload AVIF, and those created before 6.6 are missing most of the types a single site allows. Any type core adds later (JPEG XL, for example) will also be missing from every existing network. With client-side media processing, a missing image type can also stop generated sub-sizes from being sideloaded (see PR 15859).
The check
is_multisite(). On multisite, only super admins can see Site Health (wp_maybe_grant_site_health_caps()), as with the other checks that look at the network.check_upload_mimes()matches. An extension isn't reported when another extension of the same type already allows it, sojpeisn't reported whenjpgis allowed.get_allowed_mime_types()builds them for a user withoutunfiltered_html. This also means the result doesn't depend on who is viewing it, or whether it runs from cron.manage_network_options.Open question: the length of the list
On a network still on the oldest defaults, the check currently lists about 130 extensions. For networks created between 5.8 and 6.5, it still lists dozens of non-image types (
bmp,tiff,ico,heic,txt,csv,zip, the Office and OpenDocument formats, and so on). It may be better to limit the recommendation to image formats, or to group the list by type.Testing
tests/phpunit/tests/admin/wpSiteHealthGetTestNetworkUploadFiletypes.php:The
site-healthgroup passes on single site (122 tests) and multisite (130 tests).Manually: on a multisite install, set Network Admin → Settings → Upload file types to
jpg jpeg png gif, then open Tools → Site Health on any site as a super admin.Trac ticket: TBD
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Researching how the network defaults changed, and drafting the check, tests and this description. To be reviewed by me.
🤖 Generated with Claude Code
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.