diff --git a/wp-includes/post.php b/wp-includes/post.php index 2a02400bd1..7645043a47 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -6868,6 +6868,7 @@ function wp_mime_type_icon( $mime = 0, $preferred_ext = '.png' ) { */ $dirs = apply_filters( 'icon_dirs', array( $icon_dir => $icon_dir_uri ) ); $icon_files = array(); + $all_icons = array(); while ( $dirs ) { $keys = array_keys( $dirs ); $dir = array_shift( $keys ); @@ -6887,6 +6888,7 @@ function wp_mime_type_icon( $mime = 0, $preferred_ext = '.png' ) { } continue; } + $all_icons[ "$dir/$file" ] = "$uri/$file"; if ( $ext === $preferred_ext ) { $icon_files[ "$dir/$file" ] = "$uri/$file"; } @@ -6894,6 +6896,10 @@ function wp_mime_type_icon( $mime = 0, $preferred_ext = '.png' ) { closedir( $dh ); } } + // If directory only contained icons of a non-preferred format, return those. + if ( empty( $icon_files ) ) { + $icon_files = $all_icons; + } wp_cache_add( 'icon_files', $icon_files, 'default', 600 ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 91c009f7a9..b9bbd7c16f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-RC2-57844'; +$wp_version = '6.5-RC2-57846'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.