Make WordPress Core


Ignore:
Timestamp:
10/09/2014 06:11:17 PM (11 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r29866 r29867  
    29342934        return new WP_Error('empty_term_name', __('A name is required for this term'));
    29352935
     2936    if ( $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) {
     2937        return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) );
     2938    }
     2939
    29362940    $empty_slug = false;
    29372941    if ( empty( $args['slug'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.