Title: wp_set_object_terms&#8230; question.
Last modified: August 20, 2016

---

# wp_set_object_terms… question.

 *  [freeace00](https://wordpress.org/support/users/freeace00/)
 * (@freeace00)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp_set_object_terms-question/)
 * I need to put 3 values with wp_set_object_terms
    these are categories. how can
   I change it to put all of 3 values?
 * I need to put…
 * province1, province2, province3
    city1, city2, city3
 * to City category…
 *     ```
       ### get values
       $province = $_POST['province'];
       $city = $_POST['city'];
       //echo "pro=". $province."<br/>";
       if(sizeOf($province)!=sizeOf($city)){
            echo "Error!";
            exit;
       }
       for($i = 0 ; $i < sizeOf($province); ++$i){
            //echo $province[$i]." / ";
            //echo $city[$i]."<br />";
          //if ($i=1) {
             //$province1=$province[$i];
          //}
       }
       $posted = stripslashes_deep( wp_array_slice_assoc( $_POST, $fields ) );
       $posted[province1]=$province[0];
       $posted[province2]=$province[1];
       $posted[province3]=$province[2];
       $posted[city1]=$city[0];
       $posted[city2]=$city[1];
       $posted[city3]=$city[2]; 
   
       ################## Province, City insert...###########################
       $post_into_provinces = array();
       if ($posted['province1']>0) $post_into_provinces[] = get_term_by( 'id', $posted['province1'], 'city')->slug;
       if (sizeof($post_into_provinces)>0) wp_set_object_terms($resume_id, $post_into_provinces, 'city');
       $post_into_cities = array();
       if ($posted['city1']>0) $post_into_cities[] = get_term_by( 'id', $posted['city1'], 'city')->slug;
       if (sizeof($post_into_cities)>0) wp_set_object_terms($resume_id, $post_into_cities, 'city');
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [freeace00](https://wordpress.org/support/users/freeace00/)
 * (@freeace00)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp_set_object_terms-question/#post-3522325)
 * hey help??

Viewing 1 replies (of 1 total)

The topic ‘wp_set_object_terms… question.’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [freeace00](https://wordpress.org/support/users/freeace00/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/wp_set_object_terms-question/#post-3522325)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
