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

query multiple taxonomies

First of all, get all term slugs from the custom taxonomy space by current post ID. $space_terms = wp_get_post_terms( $post->ID, ‘space’ ); if( $space_terms ) { $space_terms = array(); foreach( $space_terms as $term ) { $space_terms[] = $term->slug; } } You should specify the logical relationship between each inner taxonomy array when there is more … Read more