Make WordPress Core

Opened 16 months ago

#57428 new defect (bug)

Walker_Nav_Menu::start_el() $data_object is not a WP_Post

Reported by: jdamner's profile jdamner Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 6.1.1
Component: Menus Keywords:
Focuses: docs Cc:

Description

The inline docs for Walker_Nav_menu::start_el() state that the $data_object parameter is a WP_Post object. This isn't accurate as the object that comes in has various properties such as $title and $url which do not exist on a standard WP_Post object.

The docs were changed from object to WP_Post here https://core.trac.wordpress.org/changeset/38559, but it's not clear why.

Proposed solutions would be to revert this to an object parameter, leaving it to the developer to find out what type of object is being passed in, or an improvement would be to define an object type for a Walker_Nav_Menu_Data_Object (likely extending WP_Post) that documents all possible/acceptable properties that would be expected to be able to be used in a walker.

Change History (0)

Note: See TracTickets for help on using tickets.