I have recently moved away from Joomla and starting using WP because of ACF. I think it is great.
Currently I am working on a project where we have custom taxonomy called ‘Authors’, but we have decided to removed it and use custom post type instead. So, I have created a new custom post type called ‘Journal Authors’ and converted all of the taxonomy ‘Authors’ into the new custom post type.
In ACF I have created a ‘relationship’ field type and filtered by this new ‘Journal Authors’ custom post type and applied it to the Posts.
Now, my question is how can I automatically select the ACF ‘Journal Authors’ based on the ‘Authors’ taxonomy selection? We don’t want to open each post and select manually.
I hope my explanation make sense. Please see the screenshots.
I would be very grateful if you could please provide little help.
The only way that you can do this is if there is some connection between the old taxonomy and the new post type.
If this connection exists or if there is some data in each that can be relied on that can be used, for example if you can guarantee that post slug and the term slug will match. Otherwise you may need to add a taxonomy field to the new post type to select the old taxonomy so that you have some kind of a connection.
If this connection can be made then I would create an acf/load_value filter for the relationship field. In this filter, if the value is empty then I would get the value of the old taxonomy field, get the posts related to that term and populated the value of the relationship field with the array of IDs that this returns.
Thank you for your reply. I will look into the acf/load_value filter see if I can make it work.
I was wondering if it might be easier to use WP All Import plugin to export the old taxonomy selections and then import it into the ACF relationship filed.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.