[wp-trac] [WordPress Trac] #58932: wp_setup_nav_menu_item() throws PHP warning when using virtual menu-items

WordPress Trac noreply at wordpress.org
Sat Jan 10 06:36:57 UTC 2026


#58932: wp_setup_nav_menu_item() throws PHP warning when using virtual menu-items
--------------------------------------+--------------------------
 Reporter:  apedog                    |       Owner:  westonruter
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  7.0
Component:  Menus                     |     Version:  5.4
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+--------------------------
Changes (by westonruter):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"61465" 61465]:
 {{{
 #!CommitTicketReference repository="" revision="61465"
 Menus: Ensure a `WP_Post` instance gets passed to `get_post_states()` in
 `wp_setup_nav_menu_item()`.

 The `get_post_states()` function is also hardened to short-circuit in case
 a non-`WP_Post` is passed. A test is added to verify this.

 Developed in https://github.com/WordPress/wordpress-develop/pull/10706

 Follow-up to [47211].

 Props apedog, josephscott, joemcgill, westonruter.
 See #49374.
 Fixes #58932.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58932#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list