-1

I’m looking to convert around 300 categories, each with advanced custom fields, to a custom taxonomy so I have better website structure.

However with all of the plugins I’ve used so far, I can move the terms from the Category taxonomy to the custom taxonomy called Brands, and it keeps the standard WordPress data (Name, slug, description etc) but seems to lose the Advanced Custom Fields and Yoast data associated with that term – but as soon as I move the term back to the original “Category”, the data reappears.

I was wondering if anyone knew of a method of bulk converting Categories to a custom taxonomy, so that it keeps access to the ACF/Yoast data?

Thank you in advance

0

I think you can retrieve all your custom Categories as term object. Than create your categories and wp_insert_term() should help you. In ACF field setting - include your taxonomy in Locations rules. Yoast meta save data in meta_query. For taxonomy - wp_termmeta. For each your category - extract meta fields and import to new term.

This should be one loop for old categories. I might you understand me. Sorry for my English.

  • Thank you so much for this Maxim, I appreciate your input :) – Joey Feb 12 '18 at 10:57
0

This is basically because the plugins use an outdated way to associate meta information with taxonomies, a way which relies on mapping the taxonomy id into specific options in the options table. Once you change the taxonomy with which the term is associate, those plugins can not access that data because the taxonomy id for the term had changed and everything got out of sync.

  • Hi Mark - Thanks for this, I appreciate your response - just to confirm the individual category/taxonomy ID doesn't change when it's converted to the new taxonomy (but obviously the taxonomy type does) - so the best option would to have something custom coded to convert everything? – Joey Feb 12 '18 at 10:57
  • You should ask the authors of the plugins. They were following an old convention on how to store meta data for terms, a convention which is outdated now. They most likely have some code snippet that will let you "migrate" the data to different taxonomy. It should amount to changing the name of the relevant option. – Mark Kaplun Feb 12 '18 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.