I downloaded and activated “WP Media Tagger version 4.0.4”, by phd38. As you observed, this plugin creates a database table “mediatagger” and stores the “object_id” and “term_taxonomy_id” for each assignment you make with the plugin’s “MediaTagger – Explorer” and “MediaTagger – Editor” screens.
You can use the “MLA Custom Field and IPTC/EXIF Mapping Actions and Filters (Hooks)” (see the Settings/Media Library Assistant Documentation tab for more information) to give you a place to add some code for moving the assignments from the MediaTagger table to “real” WordPress taxonomy terms. Here’s an outline of the process:
- Define a Custom Field mapping rule called something like “Media Tagger”. This doesn’t have to actually map any data; it gives you a way of triggering your code to do the database conversion.
- Copy and activate the “mla-mapping-hooks-example.php” plugin as described in the Documentation.
- Add your code to the “mla_mapping_rule” filter, which is a convenient place to do your work. It’s called for every rule, even rules with Data Source “none”.
- Use the “Map Custom Field Metadata” links on the Media/Edit Media screen or in the Media/Assistant submenu Bulk Edit area to test your work on one or more items. Adjust your code as necessary.
- When you’re satisfied that the rule is working, use the “Map All Attachments” buttons on the Settings/Media Library Assistant Custom Fields tab to run you code for all of the items in the Media Library.
- When you’re done, deactivate the “mla-mapping-hooks-example.php” plugin and delete your Custom Field mapping rule.
I can give you more details on any step of the process if you need it, and answer any questions.
The database work is straightforward:
- Select the term_taxonomy_id from the mediatagger table for the post_ID (passed to the MLA filter).
- Select the term_id and taxonomy from the term_taxonomy table for the term_taxonomy_id.
- Use
wp_set_object_terms()
to assign the taxonomy and term_id value(s) to the post_ID. You can either replace any existing terms or append the new terms.
- Optionally, remove the object_id and term assignments from the MediaTagger table.
You can also add logic to assign the terms in a different taxonomy, e.g., assign the new terms in “Att. Tags” even though you were using the WordPress Tags taxonomy before.
I can give you more detailed instructions and some sample code if that’s helpful. Let me know:
- Do you want to replace any terms in the destination taxonomy, or just add to the terms already there?
- Which taxonomy do you want to assign the new terms in?
- Do you want to delete the terms from the MediaTagger table after they are assigned to the destination taxonomy?
Thanks for your interest in the plugin and for this interesting question. I will leave the topic unresolved until I hear back from you.