Return an error when adding a term to a non-existent parent.
Parallels the logic of wp_insert_term(), introduced in [29196]. Props jesin. Fixes #29614. Built from https://develop.svn.wordpress.org/trunk@29867 git-svn-id: http://core.svn.wordpress.org/trunk@29627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a724b435d8
commit
d088de7195
|
@ -2933,6 +2933,10 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) {
|
|||
if ( '' == trim($name) )
|
||||
return new WP_Error('empty_term_name', __('A name is required for this term'));
|
||||
|
||||
if ( $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) {
|
||||
return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) );
|
||||
}
|
||||
|
||||
$empty_slug = false;
|
||||
if ( empty( $args['slug'] ) ) {
|
||||
$empty_slug = true;
|
||||
|
|
Loading…
Reference in New Issue