I have a custom post type called ‘vendor’. That post type has an associated taxonomy called “filtered” and that taxonomy has a term called “enabled”. In my options page I have a post object field that lets user to select any post in the above post type. I would like to then dynamically assign the taxonomy term “enabled” to every post selected in that post object field. It should be dynamic, meaning if a post gets removed from that list, the term also gets removed from the said post.
I know it sounds like a weird way of doing things, but I’m first letting user select which items are highlighted on the site, but I want to make it an easier UIX so that they don’t need to go also assign a term for every post separately as well, but rather do that based on their selection in the post object field.
I’m not exactly sure where to even start with this so any help would be greatly appreciated, thanks!
I have some kind of idea how to use wp_set_object_terms() to set the terms, but having trouble gathering all posts in the Post Object field and then adding the term into them. And don’t really have any idea how to make the dynamic aspect of removing the term if posts gets removed from the Post Object field.