Title: Call to undefined function  wp_set_object_terms()
Last modified: August 22, 2016

---

# Call to undefined function wp_set_object_terms()

 *  [nirav](https://wordpress.org/support/users/gowmukhigmailcom/)
 * (@gowmukhigmailcom)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_set_object_terms/)
 * I want the users to be able to add tags to any post. I have a child theme twentytwelve-
   child.
 * In content.php I have written below code snippet. As you can see taxonomy_exists()
   function runs fine, but when I add the line
    wp_set_object_terms($post_id, $user_tags,‘
   post_tag’, true ); it gives me an error “call to undefined function”.
 * Both the functions are from the same “taxonomy.php” file which means that file
   is included, so why am I getting this error for for wp_set_object_terms function?
 * Please help.
 *     ```
       <?php if ( is_single() ) { 
   
        $action=$_REQUEST['action'];
        $user_tags=$_REQUEST['user_tags'];
        $post_id=get_the_ID();
        if($action!="" && $user_tags!=null)
       {
       echo taxonomy_exists('post_tag');
       wp_set_object_terms($post_id, $user_tags, 'post_tag', true );
       }
   
       ?>
       <form  action="" method="POST" enctype="multipart/form-data">
           <input type="hidden" name="action" value="submit">
       Add more products/services offered(use comma to separate items): <p><textarea rows="10" cols="80" name="user_tags"></textarea></p>
       <Center><input style="font-size:12pt;" type="submit" value="Submit" name="add-tags"/></CENTER>
       </form>
       <?php } ?>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [nirav](https://wordpress.org/support/users/gowmukhigmailcom/)
 * (@gowmukhigmailcom)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_set_object_terms/#post-5554072)
 * The same code if placed in original theme’s content.php file instead of the child
   theme file, works FINE.

Viewing 1 replies (of 1 total)

The topic ‘Call to undefined function wp_set_object_terms()’ is closed to new replies.

## Tags

 * [Call to undefined function:](https://wordpress.org/support/topic-tag/call-to-undefined-function/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [nirav](https://wordpress.org/support/users/gowmukhigmailcom/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_set_object_terms/#post-5554072)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
