Subscribe to
Posts
Comments
NSLog(); Header Image

WordPress Category Parents

Imagine I have a blog which has nested categories. Category "C" is a child of category "B," which is itself a child of category "A." I can draw this up as A > B > C > D.

I'd like to get the category ID for the original parent ("A" in this case), yet WordPress doesn't have any built-in functionality to do this.

Any ideas? Everything I've come up with has been (seemingly) too complex to be the correct and/or "best" solution.

There exists a function cat_is_ancestor_of in "category.php," but it doesn't seem to work.

Trackback URI | Comments RSS

Leave a Reply

Please abide by the comment policy. Valid HTML includes: <blockquote><p>, <em>, <strong>, <ul>, <ol>, and <a href>. Please use the "Quote Me" functionality to quote comments.