Don't create blank terms. Props ionfish and jhodgdon. fixes #5494
git-svn-id: http://svn.automattic.com/wordpress/trunk@6424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
99ed3ba7ce
commit
5cb5750259
|
@ -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) )
|
||||
|
|
Loading…
Reference in New Issue