Catch WP_Error. Props tellyworth. fixes #5226

git-svn-id: https://develop.svn.wordpress.org/trunk@6271 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-10-18 15:55:15 +00:00
parent 643d2a8cb5
commit 73bc9fb9ba
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;