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
$object_id is supposed to be a post’s ID, make sure first that $post->ID would even output an ID, if not, the problem lies there.