[wp-trac] [WordPress Trac] #37026: PHP Notice: Trying to get property of non-object in wp-admin\nav-menus.php on line 836

WordPress Trac noreply at wordpress.org
Sat May 31 05:37:15 UTC 2025


#37026: PHP Notice:  Trying to get property of non-object in wp-admin\nav-menus.php
on line 836
--------------------------+-----------------------------
 Reporter:  skylarkcob    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Menus         |     Version:  4.5.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------------

Comment (by apermo):

 I've reviewed @sabernhardt s Patch and it will fix #63484 and this since
 the additional call of `is_nav_menu( $menu_locations[ $location ] )` will
 prevent `wp_get_nav_menu_object()` from returning false.

 One minor improvement on it, I've changed the order, so that `is_nav_menu(
 $menu_locations[ $location ] )` as the most expensive function will be
 called last, it likely won't make any measurable difference since it's
 backend code that's not regularly called, but it's good practice to sort
 conditions from cheap to expensive. And there are performance tickets just
 doing this.

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


More information about the wp-trac mailing list