How To Add Custom Fields To WordPress Media Uploader

If you’re a photographer or something like that, then you might wanna add copyright or some other custom fields to WordPress media uploader to customize your blog’s front-end or just for giving the original photographer some credits. WordPress stores images as posts in the attachment post type, so adding some custom data is like adding custom fields to attachment post type. Here’s how you can do that.

Just add following code, which comes from Bill Erickson, to the functions.php of your current theme or a site-specific plugin:

That’s it! Now your custom fields will appear in your media uploader and media gallery.

You can now call the custom field value in the loop with the following snippet:

Or if you wanna call the information in other theme files, then use the following snippet: