Opened 9 hours ago
Last modified 7 hours ago
#66417 new defect (bug)
wp_read_audio_metadata() keeps no tags from FLAC, Ogg or M4A files
| Reported by: | JoeFusco | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Media | Version: | 3.6 |
| Severity: | normal | Keywords: | has-patch has-unit-tests needs-testing |
| Cc: | Focuses: |
Description
wp_add_id3_tag_data() reads tags only from ID3. FLAC and Ogg files store tags as Vorbis comments, and M4A files as QuickTime atoms, so these files keep no title, artist, album, year or track number.
Steps to reproduce
ffmpeg -f lavfi -i anullsrc -t 1 -metadata title=Test -metadata artist=Band t.flac ffmpeg -f lavfi -i anullsrc -t 1 -metadata title=Test -metadata artist=Band t.mp3
Upload both and compare wp_get_attachment_metadata(). The MP3 has title and artist; the FLAC has neither. Reproduces on trunk with no plugins active.
Proposed fix
When a file has no ID3 tags, read the first tag set in $data['tags'], renaming keys to their ID3 names:
| Vorbis / QuickTime | ID3 |
|---|---|
albumartist, album_artist | band
|
date, creation_date | year
|
tracknumber | track_number
|
discnumber, disc_number | part_of_a_set
|
lyrics | unsynchronised_lyric
|
ID3 takes precedence when both exist, and tags never replace what was read from the stream, such as its encoder.
Change History (3)
This ticket was mentioned in PR #15185 on WordPress/wordpress-develop by @JoeFusco.
9 hours ago
#1
- Keywords has-patch has-unit-tests added
@adamsilverstein commented on PR #15185:
7 hours ago
#2
Thanks @josephfusco - the code looks good! It would be good to have some more users testing it with real files or some data or documentation to back up the fields you chose.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
wp_add_id3_tag_data()reads tags only from ID3, so FLAC, Ogg and M4A files keep no title, artist, album, year or track number. When a file has no ID3, this reads the first other tag set getID3 found, renaming the keys whose ID3 name differs, and never replaces what was read from the stream. For files core already handles, the only change is that videos also keep their container tags (such asencoding_toolon MP4); no existing value changes.<details>
<summary>Use of AI Tools</summary>
AI assistance: Yes
Tool(s): Claude Code
Model(s): claude-opus-5-5
Used for: Finding the bug, writing the patch and its tests; reviewed by me.
</details>