Catch WP_Error. Props tellyworth. fixes #5226

git-svn-id: http://svn.automattic.com/wordpress/trunk@6271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-10-18 15:55:15 +00:00
parent 0d3dc6f181
commit 6edc7aed5c
1 changed files with 2 additions and 0 deletions

View File

@ -1119,6 +1119,8 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
foreach ($terms as $term) {
if ( !$id = is_term($term, $taxonomy) )
$id = wp_insert_term($term, $taxonomy);
if ( is_wp_error($id) )
return $id;
$term_ids[] = $id['term_id'];
$id = $id['term_taxonomy_id'];
$tt_ids[] = $id;