Make WordPress Core


Ignore:
Timestamp:
09/22/2007 06:01:08 PM (19 years ago)
Author:
ryan
Message:

Term with slug that conflicts with existing term with different parent gets a new term entry with a unique slug. see #5034

File:
1 edited

Legend:

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

    r6026 r6157  
    7474        $parent = $category_parent;
    7575
    76         $name = apply_filters('pre_category_name', $name);
    77 
    78         if ( empty ($slug) )
    79                 $slug = sanitize_title($name);
    80         else
    81                 $slug = sanitize_title($slug);
    82         $slug = apply_filters('pre_category_nicename', $slug);
    83 
    84         if ( empty ($description) )
    85                 $description = '';
    86         $description = apply_filters('pre_category_description', $description);
    87 
    8876        $parent = (int) $parent;
    8977        if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
     
    9785                $cat_ID = wp_insert_term($cat_name, 'category', $args);
    9886
     87        if ( is_wp_error($cat_ID) )
     88                return 0;
     89
    9990        return $cat_ID['term_id'];
    10091}
     
    10596        $cat_ID = (int) $catarr['cat_ID'];
    10697
    107         if( $cat_ID == $catarr['category_parent'] )
     98        if ( $cat_ID == $catarr['category_parent'] )
    10899                return false;
    109100
Note: See TracChangeset for help on using the changeset viewer.