You can pass an array of terms to wp_set_object_terms
, there is no need for the for each:
$genres= array('action', 'comedy', 'horror');
$ret = wp_set_object_terms( $postId, $genres, 'genres');
You can pass an array of terms to wp_set_object_terms
, there is no need for the for each:
$genres= array('action', 'comedy', 'horror');
$ret = wp_set_object_terms( $postId, $genres, 'genres');