Make WordPress Core


Ignore:
Timestamp:
01/04/2012 10:44:19 PM (10 years ago)
Author:
ryan
Message:

Introduce term_is_ancestor_of(). Finish taxonomy support for wp_insert_category(). Props garyc40. fixes #15581

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category.php

    r16412 r19678  
    208208 */
    209209function cat_is_ancestor_of( $cat1, $cat2 ) {
    210     if ( ! isset($cat1->term_id) )
    211         $cat1 = &get_category( $cat1 );
    212     if ( ! isset($cat2->parent) )
    213         $cat2 = &get_category( $cat2 );
    214 
    215     if ( empty($cat1->term_id) || empty($cat2->parent) )
    216         return false;
    217     if ( $cat2->parent == $cat1->term_id )
    218         return true;
    219 
    220     return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );
    221 }
    222 
     210    return term_is_ancestor_of( $cat1, $cat2, 'category' );
     211}
    223212
    224213/**
     
    235224    return sanitize_term( $category, 'category', $context );
    236225}
    237 
    238226
    239227/**
     
    255243/* Tags */
    256244
    257 
    258245/**
    259246 * Retrieves all post tags.
     
    277264    return $tags;
    278265}
    279 
    280266
    281267/**
     
    302288}
    303289
    304 
    305290/* Cache */
    306 
    307291
    308292/**
     
    317301    clean_term_cache( $id, 'category' );
    318302}
    319 
    320303
    321304/**
     
    356339}
    357340
    358 
    359341?>
Note: See TracChangeset for help on using the changeset viewer.