From a79d5c99645b94fc7c8f6651c2dd5ecfc55f5e9a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 13 Apr 2010 14:32:30 +0000 Subject: [PATCH] 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 --- wp-includes/taxonomy.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 78b21779ac..292d744d7b 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -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'];