Support » Plugin: Media Library Assistant » Bulk replace a word in media titles

  • Resolved lmitrea

    (@lmitrea)


    Hi!

    I’ve just changed my business name and domain, but keeping the exact same wp installation and website. I need to rename the media files from the old business name to the new business name, so looking for a Bulk Replace solution for a specific word in the title, not the entire title.

    for example, my naming structure is “bride-groom-by-liana-mitrea-venue-date”, and trying to change everything to “bride-groom-by-NEW-NAME-venue-date”.

    Thanks!

    The page I need help with: [log in to see the link]

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

    (@dglingren)

    Thanks for your question. You can use MLA’s Bulk Edit feature or an IPTC/EXIF mapping rule with a Content Template to accomplish your goal.

    You can find more information in the “Field-level option/format values” section of the Settings/Media Library Assistant Documentation tab. For example, the entry for str_replace reads:

    ,str_replace(s,r) – Replace all occurrences of the “search” string (s) with the “replacement” string (r). If search and replacement are arrays, then str_replace() takes a value from each array and uses them to search and replace on subject. If replace has fewer values than search, then an empty string is used for the rest of replacement values. If search is an array and replace is a string, then this replacement string is used for every value of search. You can find complete information on “search” and “replacement”, including examples, at: http://php.net/manual/en/function.str-replace.php.

    For more complex replacement tasks you can investigate the “Regular Expression Features” information in the Documentation, but these are not required for your specific application.

    For the example you gave in your post, the Content Template would be:

    template:[+post_title,str_replace('liana-mitrea','NEW-NAME')+]
    

    You can use the template on a one-time basis using MLA’s Bulk Edit action in the Media/Assistant submenu:

    1. Navigate to the Media/Assistant admin screen.
    2. Check the box to the left of each item you want to edit.
    3. Pull down the “Bulk Actions” control and select “Edit”.
    4. Click “Apply” to open the Bulk Edit Area.
    5. Make the changes you want to apply to the selected items. For example, enter the Content Template given above in the Title Text text box in the right-hand column. This replaces the selected word(s) in the item Title.
    6. Click “Update” in the lower-right corner of the Bulk Edit area to apply your changes.
    7. When the operation is complete, click “Refresh” to see the results.

    Using the template and the Bulk Edit area should make the job easy. You can also define a mapping rule perform the update:

    1. Go to the Settings/Media Library Assistant IPTC/EXIF tab.
    2. If you want to apply the rule to new items as they are uploaded, check the “Enable IPTC/EXIF Mapping when adding new media” and “Enable IPTC/EXIF Mapping when updating media metadata” boxes.
    3. Scroll down to the “Standard field mapping” section.
    4. Locate the “Title” rule entry and click the “Edit” rollover action.
    5. In the “IPTC Value” dropdown control leave the default “- None (select a value) -” in place.
    6. In the “EXIF/Template Value” text box enter the Content Template given above.
    7. In the “Priority” dropdown, select “EXIF”.
    8. In the “Existing Text” dropdown, select “Replace”. This will apply the update to all of the existing Title values.
    9. Scroll down to the bottom of the screen and click “Save Changes”.

    Once you define a rule you can apply it to a single item, multiple items or all items:

    • To map a single item, go to the Media/Assistant submenu and click the thumbnail of the item you want (or click the “Edit” rollover action) to get the Media/Edit Media screen. You can click the “Map IPTC/EXIF metadata” link to run your rules on this item, then scroll down and look at the “Alternative Text” meta box to inspect the results.
    • To map two or more items, go to the Media/Assistant submenu and click the checkbox next to the items you want. Then, select “Edit” from the “Bulk Actions” dropdown above the checkboxes and click “Apply” to open the Bulk Edit area. Click the “Map IPTC/EXIF metadata” button to run your rules on the selected items.
    • To map all of your items, stay on the Settings/Media Library Assistant IPTC/EXIF tab and click the “Execute” rollover action for the ALT Text rule. This may take a while.
    • The Settings/Media Library Assistant IPTC/EXIF tab also has an “Execute” Bulk Action you can use to apply several rules at once, and an “Execute All Rules” button to run all of the rules against all of your items.

    I hope that gives you what you need to accomplish your task. I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above suggestions. Thanks for your interest in the plugin.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.