Thanks for your question and for all the details of your application.
As you discovered, WordPress hierarchical taxonomies allow terms with the same name/label to appear as root terms or child terms. You could change your mapping rule and set the parent to “Height”, but then ALL of the IPTC Keywords would become child terms of the Height parent. As I recall, you have other parent/child relationships mixed in as Keyword values; is that right?
If all of your Keywords are unique, a workable solution would be to first search the taxonomy for an existing term with a matching name and use it if it exists. If not, the new term could be added as a root term or, perhaps, under the term you set in the Parent field in the mapping rule. This would require some PHP code that intercepts the hooks provided by the MLA mapping process.
Let me know if my assumptions are correct and if the PHP/hooks solution would work for you.
Thread Starter
anonymized-15301845
(@anonymized-15301845)
As you discovered, WordPress hierarchical taxonomies allow terms with the same name/label to appear as root terms or child terms. You could change your mapping rule and set the parent to “Height”, but then ALL of the IPTC Keywords would become child terms of the Height parent. As I recall, you have other parent/child relationships mixed in as Keyword values; is that right?
That’s right.
If all of your Keywords are unique, a workable solution would be to first search the taxonomy for an existing term with a matching name and use it if it exists. If not, the new term could be added as a root term or, perhaps, under the term you set in the Parent field in the mapping rule. This would require some PHP code that intercepts the hooks provided by the MLA mapping process.
Let me know if my assumptions are correct and if the PHP/hooks solution would work for you.
This solution seems perfect to me ! 🙂
Thanks.
Thanks for your patience while I looked into this issue. I decided that the failure to locate existing child terms during the mapping process in, in fact, and MLA defect. If you do not specify a “Parent” term for a hierarchical taxonomy mapping rule an incoming value should match any term with the same name regardless of where it occurs in the hierarchy.
I have uploaded A new MLA Development Version dated 20170309 that corrects the problem and should work the way you intend. To get the Development Version, follow the instructions in this earlier topic:
Shortcode not working in (special) widget
It would be great if you can install the Development Version and let me know how it works for you. Thanks for inspiring an MLA fix/enhancement.
Thread Starter
anonymized-15301845
(@anonymized-15301845)
It would be great if you can install the Development Version and let me know how it works for you.
Unfortunately, it’s not working, att. caterogies are still created even if they exist. In which file is this code located ? How do you perform search ?
-
This reply was modified 9 years, 2 months ago by
anonymized-15301845.
Thread Starter
anonymized-15301845
(@anonymized-15301845)
It’s working now, thanks David ! 🙂