WordPress.org

Make WordPress Core

Ticket #23378: 23378.diff

File 23378.diff, 1.1 KB (added by danielbachhuber, 5 months ago)
  • wp-includes/taxonomy.php

     
    20562056 
    20572057        $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); 
    20582058        $args = wp_parse_args($args, $defaults); 
     2059 
     2060        // 'parent' argument could be a slug too 
     2061        if ( ! is_numeric( $args['parent'] ) ) { 
     2062                $term_parent = get_term_by( 'slug', $args['parent'], $taxonomy ); 
     2063                if ( $term_parent ) 
     2064                        $args['parent'] = $term_parent->term_id; 
     2065        } 
     2066 
    20592067        $args['name'] = $term; 
    20602068        $args['taxonomy'] = $taxonomy; 
    20612069        $args = sanitize_term($args, $taxonomy, 'db'); 
     
    23682376 
    23692377        $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); 
    23702378        $args = wp_parse_args($args, $defaults); 
     2379 
     2380        // 'parent' argument could be a slug too 
     2381        if ( ! is_numeric( $args['parent'] ) ) { 
     2382                $term_parent = get_term_by( 'slug', $args['parent'], $taxonomy ); 
     2383                if ( $term_parent ) 
     2384                        $args['parent'] = $term_parent->term_id; 
     2385        } 
     2386 
    23712387        $args = sanitize_term($args, $taxonomy, 'db'); 
    23722388        extract($args, EXTR_SKIP); 
    23732389