Copy taxonomy terms from one post to another programmatically
This will work: wp_set_object_terms( ‘2’, wp_get_object_terms( ‘1’, ‘my_taxonomy’, array(“fields”=>”ids”) ), ‘my_taxonomy’ ); Explanation: I added this: ,array(“fields”=>”ids”) to the attempt i wrote in the question to make the wp_get_object_terms return array of ids alone (what the wp_set_object_terms want to get.