From 364d78f689e79e5223e6ebbf6ba320632efb4235 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 21 Jul 2008 21:53:32 +0000 Subject: [PATCH] Don't allow empty term names. Props scohoust. fixes #7336 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@8393 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 8ed744cd0..acba6d2a9 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1199,6 +1199,9 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { if ( is_int($term) && 0 == $term ) return new WP_Error('invalid_term_id', __('Invalid term ID')); + if ( '' == trim($term) ) + return new WP_Error('empty_term_name', __('A name is required for this term')); + $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); $args = wp_parse_args($args, $defaults); $args['name'] = $term; @@ -1469,6 +1472,9 @@ function wp_update_term( $term, $taxonomy, $args = array() ) { $name = stripslashes($name); $description = stripslashes($description); + if ( '' == trim($name) ) + return new WP_Error('empty_term_name', __('A name is required for this term')); + $empty_slug = false; if ( empty($slug) ) { $empty_slug = true;