Assign Custom post to Custom Taxonomy

I have a custom taxonomy called ‘product_type’ and a a custom post called ‘product’. I have a cron job that is pulling in data from an external system and adds products as custom posts using insert_post($post). This returns the post id. I now need to assign the product to the ‘DVD’ product_type in the taxonomy.
I have tried wp_set_object_terms( $object_id, 'dvd', 'product_type' ) but I dont know what goes in the object_id variable, post_id doesnt work.

Can anyone help please?
John

Related posts

Leave a Reply

1 comment