From f86da689784eafcf9f6d4ad0804aee9f4a23fbc7 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 19 Dec 2007 23:25:11 +0000 Subject: [PATCH] Don't create blank terms. Props ionfish and jhodgdon. fixes #5494 git-svn-id: https://develop.svn.wordpress.org/trunk@6424 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/taxonomy.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 6131f6fba0..416c7a9f0d 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1205,6 +1205,9 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) { $term_ids = array(); foreach ($terms as $term) { + if ( !strlen(trim($term)) ) + continue; + if ( !$id = is_term($term, $taxonomy) ) $id = wp_insert_term($term, $taxonomy); if ( is_wp_error($id) )