WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 0 down vote accepted

$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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.