diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 5367f51e06f06..029ee636101a9 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -3295,7 +3295,7 @@ function wp_match_mime_types( $wildcard_mime_types, $real_mime_types ) { foreach ( $patternses as $patterns ) { foreach ( $patterns as $type => $pattern ) { foreach ( (array) $real_mime_types as $real ) { - if ( preg_match( "#$pattern#", $real ) + if ( is_string( $real ) && ! empty( $real ) && preg_match( "#$pattern#", $real ) && ( empty( $matches[ $type ] ) || false === array_search( $real, $matches[ $type ], true ) ) ) { $matches[ $type ][] = $real;