Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.