Media Data WordPress Plugin
Your photos, songs, and videos hold more information than you might think—camera settings, recording details, dimensions, and more. WordPress actually saves all of that data when you upload a file but doesn’t make it easy to showcase it. The Media Data plugin changes that.
Over the weekend, I quietly tagged version 1.0 of X3P0: Media Data, my latest WordPress plugin. It does just what it says on the tin: it showcases media data.
Typically, I’d wait until my plugins are in the WordPress plugin directory to announce them for public release, but my submission was behind 400+ other plugins in the queue. In the meantime, you can always grab a downloadable ZIP from the plugin’s GitHub Releases page.
This is a project that’s near and dear to my heart. I’ve included some version of the original script in my themes for well over a decade, primarily for displaying metadata about audio, video, and image files on their respective attachment pages. Until the block editor came along, there really wasn’t a good way to let users configure it without diving into code.
In the last couple of months, I’ve worked to “blockify” it, making the functionality available to anyone. I’ve also overhauled the original code to use modern, object-oriented PHP and made it extensible for other developers.
What Does Media Data Do?
The plugin is actually made of two blocks:
- Media Data: A container block for assigning a media ID and wrapping Media Data Field blocks.
- Media Data Field: A block that displays a particular piece of data or metadata about the media. This block has a nearly two dozen variations, such as Title, Camera, Duration, Orientation, and more.
In a nutshell, you can insert a Media Data block, select a media file from the Media Library or upload a new file. The block will then automatically insert some default Media Data Field variations (Title, File Name, MIME Type, and File Size). From there, you can add more fields or edit/remove the defaults.
Here’s an example of what it could look like placed alongside an Audio block in the editor:
WordPress 6.9 Block Bindings Support
WordPress 6.9 will also make it possible for custom blocks to support bound attributes. This Media Data block supports this for its media ID attribute out of the box.
What this means is that developers can connect a custom block binding source and showcase any fields about that media file. Here’s a screenshot of a working example from my theme’s image attachment template:
Showcase Your Media Data
This plugin works with any media file that you upload directly to WordPress, using data that WordPress extracts from the file itself, including EXIF fields and ID3 tags.
Note that the data can only be displayed if it’s not removed before you upload to WordPress. For example, many image editors have options for removing EXIF data from photos. So keep that in mind if you do any pre-processing of your media files.
Otherwise, have fun with the plugin and leave feedback or requests on GitHub.