File downloads are an important feature of Easy Digital Downloads, which are simply pieces of metadata attached to EDD products. Out of the box, EDD provides us with two fields to identify file downloads — File Name and File URL.
We can add additional metadata to Easy Digital Downloads product files by using the provided hooks inside /includes/admin/downloads/metadata.php
.
Note that you can use any form input type you want here. I recommend using the EDD_HTML_Elements class which provides an easy way to output text fields, select, checkboxes, and even Product and Category select lists.
Administrators can edit the custom metadata right next to the default File Name and File URL fields on the Download post edit screen.
To access the metadata in your templates, inspect the output from the edd_get_download_files()
function – your new custom meta key and value will be part of the array.