I have a “author” custom field with the names of author. I want to add some new features to the site so I decided that custom taxonomies will be the best solution. So what I need to do is to get the value of the custom field and pass it to the custom taxonomy called artist. Sure I can do this manually but it is more than 1000 posts so it would be hell.
I guess the solution will be connected with wp_set_object_terms(); function, but nothing I tried worked.
Thank you for any answer.
Don’t have a time to test it now but something like this should work:
You can wrap it in a function, throw it into your
functions.php
or make it a plugin. Just be sure you run it just once and not on every page load…Use the get_posts() arguments to change which posts will be affected. For example you can take advantage of
numberposts
andoffset
to split the query into a few smaller ones if your server doesn’t feel like processing 1000+ posts at once.Good luck and let me know if you need more help with any of above.