diff --git a/src/wp-includes/customize/class-wp-customize-media-control.php b/src/wp-includes/customize/class-wp-customize-media-control.php index af137512c41f3..30eed65599696 100644 --- a/src/wp-includes/customize/class-wp-customize-media-control.php +++ b/src/wp-includes/customize/class-wp-customize-media-control.php @@ -92,7 +92,7 @@ public function to_json() { * Fake an attachment model - needs all fields used by template. * Note that the default value must be a URL, NOT an attachment ID. */ - $ext = substr( $this->setting->default, -3 ); + $ext = wp_check_filetype( $this->setting->default )['ext']; $type = in_array( $ext, array( 'jpg', 'png', 'gif', 'bmp', 'webp', 'avif' ), true ) ? 'image' : 'document'; $default_attachment = array(