Good to hear from you again. Thanks for taking the time to find and install and activate the “MLA Simple Mapping Hooks” example plugin. You can use it to set the menu_order
field to 50 by defining the following IPTC/EXIF mapping rule:
- Go to the Settings/Media Library Assistant IPTC/EXIF tab.
- 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.
- Scroll down to the “Add New Custom Field Rule” section on the left side of the page.
- Click “Enter new field” to enter the custom field name manually.
- In the “Name” text box, enter
update_menu_order
exactly as shown.
- In the “IPTC Value” dropdown control leave the default, “- None (select a value) -” value in place.
- In the “EXIF/Template Value” text box, enter
template:50
. This sets the default value of 50
- In the “Priority” dropdown, select “EXIF”.
- In the “Existing Text” dropdown, select “Replace” to replace the current field content. You can’t select “Keep” because every item has a value; “0” is the WordPress default.
- In the “Status” text box, select “Active”.
- Scroll down to the bottom of the screen and click “Update”.
Once you define the 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 look at the “Menu Order” text 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 rule 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 your custom rule. This may take a while.
The first two methods will apply all active IPTC/EXIF rules to the selected item(s). This won’t be a problem if you have only the one rule, but the third method might be the best for your application.
CAUTION: This method replaces all existing values. If existing items have non-default values they will be lost. If that’s a problem you can replace only the default “0” values by using the following template: template:[+menu_order,replace( '/^ $/', 50 )+]
. The pattern is five characters: slash, caret, space, dollar sign, slash. MLA translates the “0” to a single space (for internal reasons) before applying the “replace” format code.
I hope that gets you the results you need. I am marking this topic resolved, but please update it if you have problems or further questions about the above suggestions. If you want to consider adding custom code to your theme’s functions.php
file, contact me by email to pursue that option.