[wp-trac] [WordPress Trac] #55828: Add filter in `wp_read_audio_metadata` function

WordPress Trac noreply at wordpress.org
Wed May 25 13:54:15 UTC 2022

#55828: Add filter in `wp_read_audio_metadata` function
 Reporter:  luigipulcini  |      Owner:  (none)
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  normal        |   Keywords:  has-patch
  Focuses:                |
 At the moment, the function `wp_read_audio_metadata` is returning the
 `$metadata` extracted from an uploaded audio file without applying any
 filter to it. In addition to the limitations that this poses (e.g. third-
 party plugins may want/need to attach additional properties to the
 `$metadata` array by pulling them from the `$data` array), the missing
 filter also seems to be in contrast and inconsistent with the
 corresponding `wp_read_image_metadata` and `wp_read_video_metadata`
 functions, which both filter the file metadata array before returning it
 admin/includes/image.php#L945 here] for images and
 admin/includes/media.php#L3633 here] for videos).

 This could easily be fixed by simply replacing
 admin/includes/media.php#L3700 line 3700]:

 `return $metadata;`


 `return apply_filters( 'wp_read_audio_metadata', $metadata, $file, $data

 There are so many properties stored in the ID3 tag that `get_id3()` is
 capable of extracting from the file but WordPress simply leaves behind
 that this filter is very much needed and is perfectly consistent with what
 WordPress already has for images and videos, including its hook name.

Ticket URL: <https://core.trac.wordpress.org/ticket/55828>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list