Automatically assign a Wordpress Custom Taxonomy Term to all posts in a Custom Post Type
Posted on 2014-09-23
I have a custom post type on a wordpress site with many posts in. I have created a new Taxonomy and I need to assign one of the Terms of that taxonomy to all posts in a Custom Post Type. The taxonomy is registered to that CPT and I could do this manually but there are loads so would take forever.
I think something with wp_set_object_terms should do it but I'm not sure.
So I want to be able to set this term to update all existing posts within a custom post type, and also make sure that any new posts in that CPT are automatically tagged with this taxonomy theme.
This taxonomy has several terms and I would want to assign one term to each of several CPTs in my site automatically. All CPTs are registered with the taxonomy.
Can anyone help please?