Sanity check terms. Skip term IDs that don't exist.

git-svn-id: https://develop.svn.wordpress.org/trunk@14077 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-04-13 14:32:30 +00:00
parent dadff5dda0
commit a79d5c9964
1 changed files with 5 additions and 1 deletions

View File

@ -1634,8 +1634,12 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
if ( !strlen(trim($term)) )
continue;
if ( !$term_info = is_term($term, $taxonomy) )
if ( !$term_info = is_term($term, $taxonomy) ) {
// Skip if a non-existent term ID is passed.
if ( is_int($term) )
continue;
$term_info = wp_insert_term($term, $taxonomy);
}
if ( is_wp_error($term_info) )
return $term_info;
$term_ids[] = $term_info['term_id'];