Ticket #9882: 9882.2.patch
File 9882.2.patch, 2.3 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/taxonomy.php
136 136 if ( $parent < 0 ) 137 137 $parent = 0; 138 138 139 if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )139 if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && is_cat_ancestor_of($cat_ID, $parent) ) ) 140 140 $parent = 0; 141 141 142 142 $args = compact('name', 'slug', 'parent', 'description'); -
wp-includes/category.php
200 200 * You can use either an id or the category object for both parameters. If you 201 201 * use an integer the category will be retrieved. 202 202 * 203 * @since 2.1.0203 * @since 3.0 204 204 * 205 205 * @param int|object $cat1 ID or object to check if this is the parent category. 206 206 * @param int|object $cat2 The child category. 207 207 * @return bool Whether $cat2 is child of $cat1 208 208 */ 209 function cat_is_ancestor_of( $cat1, $cat2 ) {209 function is_cat_ancestor_of( $cat1, $cat2 ) { 210 210 if ( ! isset($cat1->term_id) ) 211 211 $cat1 = &get_category( $cat1 ); 212 212 if ( ! isset($cat2->parent) ) … … 217 217 if ( $cat2->parent == $cat1->term_id ) 218 218 return true; 219 219 220 return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );220 return is_cat_ancestor_of( $cat1, get_category( $cat2->parent ) ); 221 221 } 222 222 223 223 -
wp-includes/deprecated.php
2513 2513 _deprecated_function( __FUNCTION__, '3.0' ); 2514 2514 return ''; 2515 2515 } 2516 2517 /** 2518 * Check if a category is an ancestor of another category. 2519 * 2520 * @since 2.1.0 2521 * @deprecated 3.0 2522 * @deprecated Use is_cat_ancestor_of() 2523 * @see is_cat_ancestor_of() 2524 * 2525 * @param int|object $cat1 ID or object to check if this is the parent category. 2526 * @param int|object $cat2 The child category. 2527 * @return bool Whether $cat2 is child of $cat1 2528 */ 2529 function cat_is_ancestor_of( $cat1, $cat2 ) { 2530 _deprecated_function( __FUNCTION__, '3.0', 'is_cat_ancestor_of()' ); 2531 2532 return is_cat_ancestor_of( $cat1, $cat2 ); 2533 } 2534