Sanity check terms. Skip term IDs that don't exist.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5a76e8be5d
commit
eec2968be7
|
@ -1634,8 +1634,12 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
|
||||||
if ( !strlen(trim($term)) )
|
if ( !strlen(trim($term)) )
|
||||||
continue;
|
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);
|
$term_info = wp_insert_term($term, $taxonomy);
|
||||||
|
}
|
||||||
if ( is_wp_error($term_info) )
|
if ( is_wp_error($term_info) )
|
||||||
return $term_info;
|
return $term_info;
|
||||||
$term_ids[] = $term_info['term_id'];
|
$term_ids[] = $term_info['term_id'];
|
||||||
|
|
Loading…
Reference in New Issue