Make WordPress Core


Ignore:
Timestamp:
10/20/2026 05:02:48 AM (14 hours ago)
Author:
adamsilverstein
Message:

Media: Enable client-side uploads in the Media Library and modal.

Enable client-side media processing for Uploads from the Media Library grid, the Add New Media File screen and the media modal in the block editor (in supported browsers).

These screens now use the same pipeline as block editor uploads: the original is uploaded through the REST API, sub-sizes are generated in the browser and sideloaded, then the attachment is finalized. wp_set_up_cross_origin_isolation() now also isolates the Media Library grid and the Add New Media File screen using Document Isolation Policy. Uploads huse the client-side processing still use the existing progress, tile and error UI.

When client-side processing is disabled, uploads fall back to the classic flow unchanged. Audio files, uploaders that do not post attachments, and JPEG/PNG files while plupload resizing is enabled also stay on the classic path, and a HEIC the browser cannot decode is handed to the server when its image editor supports HEIC. The Customizer, Site Icon picker and classic editor are not isolated and keep classic uploads.

See ​https://github.com/WordPress/gutenberg/issues/82409.

Props adamsilverstein, westonruter, andrewserong, sanayasir, arkaprabhachowdhury, logicrays.
Fixes #65661. See #66220.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r64436 r64588  
    35103510 * @since 6.8.0 Support was added for `audio/x-wav`.
    35113511 *
    3512  * @return string[] Array of mime types keyed by the file extension regex corresponding to those types.
     3512 * @return array<string, string> Array of mime types keyed by the file extension regex corresponding to those types.
    35133513 */
    35143514function wp_get_mime_types() {
    … …  
    35213521         * @since 3.5.0
    35223522         *
    3523          * @param string[] $wp_get_mime_types Mime types keyed by the file extension regex
    3524          *                                    corresponding to those types.
     3523         * @param array<string, string> $wp_get_mime_types Mime types keyed by the file extension regex
     3524         *                                                 corresponding to those types.
    35253525         */
    35263526        return apply_filters(
    … …  
    36463646 * @since 4.6.0
    36473647 *
    3648  * @return array[] Multi-dimensional array of file extensions types keyed by the type of file.
     3648 * @return array<string, string[]> Multi-dimensional array of file extensions types keyed by the type of file.
    36493649 */
    36503650function wp_get_ext_types() {
    … …  
    36573657         * @see wp_ext2type()
    36583658         *
    3659          * @param array[] $ext2type Multi-dimensional array of file extensions types keyed by the type of file.
     3659         * @param array<string, string[]> $ext2type Multi-dimensional array of file extensions types keyed by the type of file.
    36603660         */
    36613661        return apply_filters(
    … …  
    37313731 *
    37323732 * @param int|WP_User $user Optional. User to check. Defaults to current user.
    3733  * @return string[] Array of mime types keyed by the file extension regex corresponding
    3734  *                  to those types.
     3733 * @return array<string, string> Array of mime types keyed by the file extension regex corresponding to those types.
    37353734 */
    37363735function get_allowed_mime_types( $user = null ) {
    … …  
    37513750         * @since 2.0.0
    37523751         *
    3753          * @param array            $t    Mime types keyed by the file extension regex corresponding to those types.
    3754          * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
     3752         * @param array<string, string> $t    Mime types keyed by the file extension regex corresponding to those types.
     3753         * @param int|WP_User|null      $user User ID, User object or null if not provided (indicates current user).
    37553754         */
    37563755        return apply_filters( 'upload_mimes', $t, $user );
Note: See TracChangeset for help on using the changeset viewer.