Don't allow empty term names. Props scohoust. fixes #7336 for trunk
git-svn-id: https://develop.svn.wordpress.org/trunk@8393 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5ae1a0fe6b
commit
09f42ecdc0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user