get_category_parents problem with sub-categories (all WP Versions - to 3.5 beta)
|Reported by:||wpweaver||Owned by:|
get_category_parents does not always show full hierarchy when showing subcategories. Seems to be related to alphabetical order?
This example demonstrates the problem. Use the same words & spelling for the Category Name - because it matters to the outcome. Parent category: "Photography" and give it 2 Child categories: "Event" and "Wedding". Now create 2 posts, Post #1: Categories "Photography" & "Event", Post #2: Categories "Photography" & "Wedding".
Now use a theme with a breadcrumbs function that uses get_category_parents to generate the breadcrumbs. Yoast SEO plugin will demonstrate the problem, for example, as will the Weaver II theme.
You will get the following output when displaying the single page view of each post:
The Photography->Event post gives this correct breadcrumb:
The other Photography>Wedding gives this incorrect breadcrumb:
note the missing Wedding in the breadcrumb.
This problem shows on the latest WP 3.5 beta, too.