diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-admin/includes/media.php --- a/wp/wp-admin/includes/media.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-admin/includes/media.php Fri Sep 05 18:52:52 2025 +0200 @@ -93,7 +93,7 @@ foreach ( $tabs as $callback => $text ) { $class = ''; - if ( $current == $callback ) { + if ( $current === $callback ) { $class = " class='current'"; } @@ -773,7 +773,7 @@ $post['menu_order'] = $attachment['menu_order']; } - if ( isset( $send_id ) && $attachment_id == $send_id ) { + if ( isset( $send_id ) && $attachment_id === $send_id ) { if ( isset( $attachment['post_parent'] ) ) { $post['post_parent'] = $attachment['post_parent']; } @@ -1172,7 +1172,7 @@ foreach ( $alignments as $name => $label ) { $name = esc_attr( $name ); $output[] = ""; } @@ -1222,7 +1222,7 @@ $css_id = "image-size-{$size}-{$post->ID}"; // If this size is the default but that's not available, don't select it. - if ( $size == $check ) { + if ( $size === $check ) { if ( $enabled ) { $checked = " checked='checked'"; } else { @@ -1762,7 +1762,7 @@ if ( 'image' === $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) - && get_post_thumbnail_id( $calling_post_id ) != $attachment_id + && get_post_thumbnail_id( $calling_post_id ) !== $attachment_id ) { $calling_post = get_post( $calling_post_id ); @@ -2194,14 +2194,19 @@ $plupload_init['multi_selection'] = false; } - // Check if WebP images can be edited. - if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) { - $plupload_init['webp_upload_error'] = true; - } - - // Check if AVIF images can be edited. - if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/avif' ) ) ) { - $plupload_init['avif_upload_error'] = true; + /** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php */ + $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, null ); + + if ( $prevent_unsupported_uploads ) { + // Check if WebP images can be edited. + if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) { + $plupload_init['webp_upload_error'] = true; + } + + // Check if AVIF images can be edited. + if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/avif' ) ) ) { + $plupload_init['avif_upload_error'] = true; + } } /** @@ -2277,11 +2282,11 @@ - +
@@ -2845,38 +2850,37 @@