Opened 11 years ago
Last modified 5 years ago
#24548 new defect (bug)
_wp_menu_item_classes_by_context assumes $queried_object->ancestors is an array
Reported by: | wpsmith | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Menus | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
Recently, on a site using CPT-onomies, I ran into an interesting error with _wp_menu_item_classes_by_context().
In this function, when setting the parent class, there is a large if statement that assumes that $queried_object->ancestors
and $possible_taxonomy_ancestors[ $parent_item->object ]
are arrays.
Attachments (1)
Change History (5)
#2
follow-up:
↓ 3
@
10 years ago
- Keywords reporter-feedback added; dev-feedback removed
- Milestone changed from 3.9 to Awaiting Review
When are either of these not arrays?
For the first one, post objects always return get_post_ancestors(), which always returns an array. (It briefly did not: #22882.)
For the second one, that array must be set (the line above it) before it is treated as an array. It is set to be an array within the function.
Note: See
TracTickets for help on using
tickets.
This function...