wp_set_object_terms() is not replacing term, but creating a new one
In both the cases issue is not the other things, but the main value what you are sending to the second parameter, in your case $flightCategory: $flightCategory = array( 25 ); var_dump( $flightCategory ); wp_set_object_terms( $post_id, $flightCategory, ‘flight_categories’ ); But on the later version somehow, or literally you are actually passing something like below: $flightCategory … Read more