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
This commit is contained in:
Ryan Boren 2007-12-19 23:25:11 +00:00
parent 235b05e62d
commit f86da68978
1 changed files with 3 additions and 0 deletions

View File

@ -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) )