Fix typing in cat_is_ancestor_of(). Props filosofo. fixes #9614

git-svn-id: https://develop.svn.wordpress.org/trunk@11031 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-04-21 19:42:28 +00:00
parent b9bfa4aade
commit 360ffa3fb5
1 changed files with 3 additions and 4 deletions

View File

@ -200,14 +200,13 @@ function get_cat_name( $cat_id ) {
* @return bool Whether $cat2 is child of $cat1
*/
function cat_is_ancestor_of( $cat1, $cat2 ) {
if ( is_int( $cat1 ) )
if ( ! isset($cat1->term_id) )
$cat1 = &get_category( $cat1 );
if ( is_int( $cat2 ) )
if ( ! isset($cat2->parent) )
$cat2 = &get_category( $cat2 );
if ( !$cat1->term_id || !$cat2->parent )
if ( empty($cat1->term_id) || empty($cat2->parent) )
return false;
if ( $cat2->parent == $cat1->term_id )
return true;