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:
parent
643d2a8cb5
commit
73bc9fb9ba
@ -1119,6 +1119,8 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
|
|||||||
foreach ($terms as $term) {
|
foreach ($terms as $term) {
|
||||||
if ( !$id = is_term($term, $taxonomy) )
|
if ( !$id = is_term($term, $taxonomy) )
|
||||||
$id = wp_insert_term($term, $taxonomy);
|
$id = wp_insert_term($term, $taxonomy);
|
||||||
|
if ( is_wp_error($id) )
|
||||||
|
return $id;
|
||||||
$term_ids[] = $id['term_id'];
|
$term_ids[] = $id['term_id'];
|
||||||
$id = $id['term_taxonomy_id'];
|
$id = $id['term_taxonomy_id'];
|
||||||
$tt_ids[] = $id;
|
$tt_ids[] = $id;
|
||||||
|
Loading…
Reference in New Issue
Block a user