From eec2968be7a4b5318165d55fa6358143c1383502 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 13 Apr 2010 14:32:30 +0000 Subject: [PATCH] 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 --- 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 78b21779a..292d744d7 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'];