Make WordPress Core

Changeset 53764


Ignore:
Timestamp:
07/23/2022 08:11:51 AM (2 years ago)
Author:
audrasjb
Message:

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:

Props luigipulcini, SergeyBiryukov, mukesh27.
Fixes #55828.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r53570 r53764  
    36983698    wp_add_id3_tag_data( $metadata, $data );
    36993699
    3700     return $metadata;
     3700    $file_format = isset( $metadata['fileformat'] ) ? $metadata['fileformat'] : null;
     3701
     3702    /**
     3703     * Filters the array of metadata retrieved from an audio file.
     3704     *
     3705     * In core, usually this selection is what is stored.
     3706     * More complete data can be parsed from the `$data` parameter.
     3707     *
     3708     * @since 6.1.0
     3709     *
     3710     * @param array  $metadata       Filtered Audio metadata.
     3711     * @param string $file           Path to audio file.
     3712     * @param string $file_format    File format of audio, as analyzed by getID3.
     3713     * @param array  $data           Raw metadata from getID3.
     3714     */
     3715    return apply_filters( 'wp_read_audio_metadata', $metadata, $file, $file_format, $data );
    37013716}
    37023717
Note: See TracChangeset for help on using the changeset viewer.