• Can you provide an example of how to access (from a theme template) one of the Additional Fields uploaded when a file is uploaded to Media?

Viewing 1 replies (of 1 total)
  • Plugin Author nickboss

    (@nickboss)

    Hi, the additional fields are added to the file stored in Media Library as metadata, so you can retrieve them by knowing the attachment ID of the file and by calling wp_get_attachment_metadata like this:

    $data = wp_get_attachment_metadata($id);
    $fields = ( isset($data["WFU User Data"]) ? $data["WFU User Data"] : array() );

    Variable $fields will return an array of the additional fields of the file.

    Regards

    Nickolas

Viewing 1 replies (of 1 total)
  • The topic ‘Need example code to access additional fields’ is closed to new replies.