Media: Allow filtering audio file metadata in wp_read_audio_metadata().

This changeset introduces the `wp_read_audio_metadata` hook which allows to filter metadata extracted from an uploaded audio file.

This brings consistency with corresponding filters available for image and video file types:

- `wp_read_image_metadata` added in [6313] / #5162.
- `wp_read_video_metadata` added in [41746] / #35218.

Props luigipulcini, SergeyBiryukov, mukesh27.
Fixes #55828.

Built from https://develop.svn.wordpress.org/trunk@53764


git-svn-id: http://core.svn.wordpress.org/trunk@53323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-07-23 08:13:11 +00:00
parent 71cfaa9a5a
commit 32cc05a7c0
2 changed files with 17 additions and 2 deletions

View File

@ -3697,7 +3697,22 @@ function wp_read_audio_metadata( $file ) {
wp_add_id3_tag_data( $metadata, $data );
return $metadata;
$file_format = isset( $metadata['fileformat'] ) ? $metadata['fileformat'] : null;
/**
* Filters the array of metadata retrieved from an audio file.
*
* In core, usually this selection is what is stored.
* More complete data can be parsed from the `$data` parameter.
*
* @since 6.1.0
*
* @param array $metadata Filtered Audio metadata.
* @param string $file Path to audio file.
* @param string $file_format File format of audio, as analyzed by getID3.
* @param array $data Raw metadata from getID3.
*/
return apply_filters( 'wp_read_audio_metadata', $metadata, $file, $file_format, $data );
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-53763';
$wp_version = '6.1-alpha-53764';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.