Ticket #9882: 9882.patch
File 9882.patch, 1.9 KB (added by , 15 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_category_ancestor_of($cat_ID, $parent) ) ) 140 140 $parent = 0; 141 141 142 142 $args = compact('name', 'slug', 'parent', 'description'); -
wp-includes/category.php
194 194 * use an integer the category will be retrieved. 195 195 * 196 196 * @since 2.1.0 197 * @deprecated 2.8.1 198 * @deprecated Use is_category_ancestor_of() 199 */ 200 function cat_is_ancestor_of( $cat1, $cat2 ) { 201 _deprecated_function(__FUNCTION__, '2.8.1', 'is_category_ancestor_of()' ); 202 return is_category_ancestor_of( $cat1, $cat2 ); 203 } 204 205 /** 206 * Check if a category is an ancestor of another category. 197 207 * 208 * You can use either an id or the category object for both parameters. If you 209 * use an integer the category will be retrieved. 210 * 211 * @since 2.8.1 212 * 198 213 * @param int|object $cat1 ID or object to check if this is the parent category. 199 214 * @param int|object $cat2 The child category. 200 215 * @return bool Whether $cat2 is child of $cat1 201 216 */ 202 function cat_is_ancestor_of( $cat1, $cat2 ) {217 function is_category_ancestor_of( $cat1, $cat2 ) { 203 218 if ( ! isset($cat1->term_id) ) 204 219 $cat1 = &get_category( $cat1 ); 205 220 if ( ! isset($cat2->parent) ) … … 210 225 if ( $cat2->parent == $cat1->term_id ) 211 226 return true; 212 227 213 return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );228 return is_category_ancestor_of( $cat1, get_category( $cat2->parent ) ); 214 229 } 215 230 216 231