How to update the title of audio file through its attachment metadata

I am trying to programmatically update some metadata of audio file attached to a post. I have been able to update the artist and album properties of the audio file but title doesn't stick. I can go through media library and edit the title and it works but not through backend. Can you please assist? Here's how I do so now:

              $meta = wp_get_attachment_metadata( $attachment-ID, false);

              $meta = array (
             'artist' = $mainArtist,
                     'title' = $TitleAndFeaturedArtist,
             'album' = ' ',
                            );

                    wp_update_attachment_metadata( $attachment-ID, $meta);

The artist and album gets updated but not title. Title seems to be coming from the iD3 tag but through media library in wordpress, you can edit and set yours. I am trying to avoid manually processing over 2000 files. There has to be a way :(

Please help. Any suggestions or alternative would help

Topic audio post-meta attachments Wordpress

Category Web


I figured this out. It's because the title isn't part of the attachment metadata technically. The audio attachment itself is stored in the database as a post with a post type of attachement and applicable mime type. To update the title of the audio is to update the post title

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.