Support » Plugin: Media Library Assistant » Could you provide a guide for beginners on using custom fields

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author David Lingren


    Ah, FORTRAN, I started with FORTRAN FIV (Four Improved Version) and punch cards (great bookmarks).

    Thanks for your kind comments and your questions, and for taking the time to go back through all these support topics. Thanks as well for including the link to your web site, which was fun to have a look at.

    The MLA IPTC/EXIF mapping features were inspired by comments and suggestions from some of the photographers who use the plugin. As you know, cameras embed data in most images, and tools like Adobe Photoshop and Lightroom provide a way for you to add descriptions, notices and keywords to your images. WordPress does a bit of work with this information. Here’s what the MLA Documentation has to say:

    WordPress default title, slug and description mapping

    When WordPress uploads a new image file that contains IPTC and EXIF metadata it automatically maps metadata values to the title (post_title), name/slug (post_name) and description (post_content) fields. This happens before the MLA mapping rules are applied, so if you want to override the default mapping you must select “Replace” in the “Existing Text” column.

    The WordPress rules are somewhat complex; consult the source code if you need exact details. Roughly speaking, the priority order for mapping the post_title and post_name values from non-blank IPTC/EXIF metadata is:

    1. EXIF “Title”
    2. EXIF “ImageDescription” (if less than 80 characters)
    3. IPTC 2#105 “headline”
    4. IPTC 2#005 “object-name”
    5. IPTC 2#120 “caption-or-abstract” (if less than 80 characters)

    The priority order for mapping the post_content value from non-blank IPTC/EXIF metadata is:

    1. EXIF “ImageDescription” (if different from post_title)
    2. IPTC 2#120 “caption-or-abstract” (if different from post_title)

    The Settings/Media Library Assistant IPTC/EXIF tab lets you assign metadata to standard fields like caption, to taxonomy terms such as Att. Tags and to custom fields. The best place to start is with a bit of investigation. Open the tab and scroll down to the bottom, where it says Add a new Custom Field and Mapping Rule. Enter a custom field name, such as “IPTC Data”, skip over the IPTC Value dropdown and enter “ALL_IPTC” in the EXIF Value text box. Select EXIF in the Priority dropdown and “Replace” in the Existing Text dropdown. Finally, click Add Field to save your rule. The page will refresh and you will see your new rule in the list of Custom Field Mapping rules.

    To make your new field easily viewable, go to the Settings/Media Library Assistant Custom tab. Scroll down to where it says Add a new Mapping Rule. Select your “IPTC Data” field from the dropdown list, leave “– None …” in the Data Source dropdown (you already have data in the field) and skip the Existing Text and Format dropdowns. Check the first box, “MLA Column” and then click Add Rule to save your rule. Your new field will become a sortable, searchable column in the Media/Assistant submenu table.

    Any images you load after defining the rule will map their metadata to the custom field automatically. For your existing images, you have a choice. Mapping metadata and updating the Media Library database is a lot of (computer) work, and can take a long time if you have lots of images. You have three options:

    Single Item Edit/Edit Media screen
    For WordPress 3.5 and later, you can click the “Map IPTC/EXIF metadata” link in the “Image Metadata” postbox to apply the standing mapping rules to a single attachment. For WordPress 3.4.x and earlier, you can click the “Map IPTC/EXIF metadata” button on the Single Item Edit screen to apply the standing mapping rules.

    Bulk Action edit area
    To perform mapping for a group of attachments you can use the Bulk Action facility on the main Assistant screen. Check the attachments you want to map, select “edit” from the Bulk Actions dropdown list and click “Apply”. The bulk edit area will open with a list of the checked attachments in the left-hand column. You can click the “Map IPTC/EXIF metadata” button in the lower left corner of the area to apply the standing mapping rules to the attachments in the list.

    IPTC/EXIF screen
    To map all your images in one pass, go back to the IPTC/EXIF tab, scroll down to your rule and click Map All Attachments.

    You will have to make your own decision on which approach to try. You can’t really hurt anything; the worst outcome will be a timeout before finishing the work. If that happens, use the Bulk Edit option to apply your mapping in batches. You can always use the “Delete Rule AND Field” option to clean things up and start over.

    Now you can have a look at your data. Go to the Media/Assistant submenu and look for your new field. You can pull down the “Screen Options” (upper right corner) and remove some of the other columns to give you more room. You’ll see the IPTC identifiers and the values you’ve assigned to them. There’s a list of identifiers and friendly names in the Documentation. You can also edit a single image, scroll down to the Custom Fields metabox and look through the data there. I pulled a few images from your site and looked at the IPTC data you’ve added to them. You’ve got good coverage of several fields.

    Some good mapping choices would be:

    2#025 (keywords) to the Att. Tag or Att. Category taxonomy
    2#055 (date-created) to a custom field
    2#080 (by-line) to a custom field
    2#105 (headline) to the caption or description
    2#116 (copyright-notice) to a custom field
    2#120 (caption-or-abstract) to the ALT Text; it’s already in the Title

    Once you have data like the copyright-notice in a custom field you can to add it to your [mla_galery] displays.

    Go back to the IPTC/EXIF tab and have a go at creating more rules. Try them out on one or a few images to get a feel of what works for you.

    That should get you started. Post an update here to let me know how you’re doing and if you have any problems or further questions. Have fun!

    Wow! Thanks for such a strong starting push. I’ve been experimenting and trying out mappings to help me organize my uploads as well as getting them properly tagged during posting. I’ve run into 2 oddities:

    1) When I do the process to add a custom field name, it does work–and is very useful– but the new field is not in the drop-down box for adding a new mapping rule on the IPTC settings page, it MIGHT be in the drop-down box on the Custom Settings page (I tried 2–your IPTC example and a Copyright Notice and it did it for just the copyright notice), and it WILL be in the drop-down box on a specific Edit Media page. A bug? Or a constraint on new fields that may not be appropriate for mapping rules at some level?

    2) Previousy, if I included a media file in a post and then downloaded the image while viewing the post, the file’s metadata was transferred with the image. That isn’t working since I started doing these manipulations. That is, all of the file information (apart from the file name) is missing, not just the bits I have been using. Is there a switch somewhere that is triggering a “cleaning” of the metadata as the file is downloaded? I ran a test post with some of my new and old files, and there is a sudden change in what comes down in a transfer. However, the information is still there when I inspect the online file using MLA or the regular Library.

    Sorry to keep asking questions…it only demonstrates a keen interest in using MLA….really!

    Plugin Author David Lingren


    Thanks for the kind words; I’m glad you’re making progress. With respect to your questions (always welcome):

    1) The dropdown box is populated by a WordPress API call that returns all the fields in the postmeta table. Until you apply the rule and populate the field it isn’t in the list. I will consider an enhancement to scan the MLA mapping rules and add fields that haven’t yet been applied to the media items.

    2) MLA does not do any cleaning or modification of the media items. I believe that WordPress removes metadata from the “intermediate size” images it generates, e.g., thumbnail, small and medium. If your posts do not include the original, full size image you are getting a WordPress processed version. I haven’t tested this.

    Thanks for your help on both items. I’ve had some fun learning how to use the MLA features that are within my skill-set. And I’ll keep a look-out for your next updates. btw, I was totally delighted to donate to your fair-trade group.

    I wonder if you might consider adding something to MLA to help keep the metadata on those intermediate-size images, at least as an option. The WordPress codex says there is an option in the media settings, but I think that’s old info. Most anyone using your plug-in has a deep interest in their images and those pre-sized smaller images are so handy for including in mainly-text blog postings, but the only thing I found that kept that metadata is an old (WP 1.5!) plug-in that finally seems to have become obsolete or at least unreliable.

    Plugin Author David Lingren


    I have released version 1.42, which adds the “not yet mapped” fields to the dropdown boxes on the Settings/Media Library Assistant Custom Fields and IPTC/EXIF tabs. When you’ve updated to the new release, give it a try and let me know if you have any problems or further questions/suggestions.

    I have added your suggestion about preserving metadata in intermediate-size images to my list for consideration in future releases.

    Thanks again for your generous donation to support our work, for your ideas and for your interest in the plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Could you provide a guide for beginners on using custom fields’ is closed to new replies.