Title: wp_set_post_terms
Last modified: August 20, 2016

---

# wp_set_post_terms

 *  [welcha4](https://wordpress.org/support/users/welcha4/)
 * (@welcha4)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/wp_set_post_terms-1/)
 * I am trying to set terms from meta boxes i have added using add_meta_box(). I’m
   trying to accomplish something very similar to this post: [http://wordpress.stackexchange.com/questions/23917/wp-set-post-terms-example](http://wordpress.stackexchange.com/questions/23917/wp-set-post-terms-example)
 * However I keep running in to the same error when using wp_set_post_terms() and
   wp_set_object_terms():
    Catchable fatal error: Object of class stdClass could
   not be converted to string in /wp-includes/taxonomy.php on line 2569
 * I’ve been trying to figure this out for a while. My custom fields look like this
   after getting all the taxonomies for a particular post:
 *     ```
       foreach($taxonomies as $taxonomy) {
             $tax = $taxonomy->name;
             ?>
             <label><?php echo $taxonomy->label['name']; ?></label>
   
           	<p>
           		<input type="text" name="_ajwiv_vidlib_terms[<?php $tax ?>]" value=""/>
           	</p>
           <?php } ?>
       ```
   
 * And I am trying to set the terms like this:
 *     ```
       if(isset($_POST['_ajwiv_vidlib_terms'])) {
           foreach($_POST['_ajwiv_vidlib_terms'] as $tax => $term) {
             wp_set_post_terms(  $post_id, $terms, $tax );
           }
       ```
   
 * Any help you could provide would be greatly appreciated.
 * -AJ

Viewing 1 replies (of 1 total)

 *  Thread Starter [welcha4](https://wordpress.org/support/users/welcha4/)
 * (@welcha4)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/wp_set_post_terms-1/#post-2237701)
 * I’ve narrowed the problem down to the file where I register my custom taxonomies.
   I looked in the term_taxonomy table of the database and the taxonomies from my
   meta boxes were being saved as integers instead of strings which is certainly
   what caused this problem. However, I deleted from the database all of those taxonomies,
   terms, tax-term relationships, and any posts that that were associated with this
   problem and I am still getting that error message. I can no longer register any
   kind of custom taxonomy without receiving this error message: Catchable fatal
   error: Object of class stdClass could not be converted to string in /wp-includes/
   taxonomy.php on line 2569. I can navigate the admin area, but whenever I try 
   to view any page on the front end that uses the loop, I receive this error message.
   Please help! Thanks.

Viewing 1 replies (of 1 total)

The topic ‘wp_set_post_terms’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 1 participant
 * Last reply from: [welcha4](https://wordpress.org/support/users/welcha4/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/wp_set_post_terms-1/#post-2237701)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
