return $category;
}
-
/**
* Retrieve the ID of a category from its name.
*
return 0;
}
-
/**
* Retrieve the name of a category from its ID.
*
return $category->name;
}
-
/**
* Check if a category is an ancestor of another category.
*
* @return bool Whether $cat2 is child of $cat1
*/
function cat_is_ancestor_of( $cat1, $cat2 ) {
- if ( ! isset($cat1->term_id) )
- $cat1 = &get_category( $cat1 );
- if ( ! isset($cat2->parent) )
- $cat2 = &get_category( $cat2 );
-
- if ( empty($cat1->term_id) || empty($cat2->parent) )
- return false;
- if ( $cat2->parent == $cat1->term_id )
- return true;
-
- return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );
+ return term_is_ancestor_of( $cat1, $cat2, 'category' );
}
-
/**
* Sanitizes category data based on context.
*
return sanitize_term( $category, 'category', $context );
}
-
/**
* Sanitizes data in single category key field.
*
/* Tags */
-
/**
* Retrieves all post tags.
*
return $tags;
}
-
/**
* Retrieve post tag by tag ID or tag object.
*
return get_term( $tag, 'post_tag', $output, $filter );
}
-
/* Cache */
-
/**
* Remove the category cache data based on ID.
*
clean_term_cache( $id, 'category' );
}
-
/**
* Update category structure to old pre 2.3 from new taxonomy structure.
*
$category['category_parent'] = &$category['parent'];
}
}
-
-
-?>