Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #58044


Ignore:
Timestamp:
04/01/2023 10:01:08 PM (14 months ago)
Author:
sabernhardt
Comment:

Thanks for the report!

Is #51565 the same issue?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #58044

    • Property Keywords reporter-feedback added
  • Ticket #58044 – Description

    initial v1  
    1 /wp-includes/nave-menu.php has an issue handling bad $menu_item.
     1`/wp-includes/nav-menu.php` has an issue handling bad `$menu_item`.
    22
    33
    4 The problem is with trying to call **get_post_status(**). If a post with type ''nav_menu_item'' has a problem (I think not having a correct parent or something), the call to **get_post($menu_item->object_id)** returns NULL which then causes an error message from **get_post_states()**.
     4The problem is with trying to call `get_post_status()`. If a post with type `nav_menu_item` has a problem (I think not having a correct parent or something), the call to `get_post($menu_item->object_id)` returns NULL which then causes an error message from `get_post_states()`.
    55
    6 I had to search the site database to find the offending menu item on my theme development site and deleted the bad menu.  I think I likely deleted a page or post that had been include in a menu definition, or perhaps it was because I typically use the Parent Page to define the default menu, which is still supported bu seldom used.
     6I had to search the site database to find the offending menu item on my theme development site and deleted the bad menu.  I think I likely deleted a page or post that had been include in a menu definition, or perhaps it was because I typically use the Parent Page to define the default menu, which is still supported but seldom used.
    77
    88This error only seems to appear when using the Customizer, I'm guessing while it is generating the ''Menus'' option. Didn't get error from Dashboard Menu, nor have I tried this on a block theme.
    99
    10 The problem is found around line 833 in nav-menu.php.
     10The problem is found around line 833 in `nav-menu.php`.
    1111
    1212Here's a possible fix which worked with my bad menu definition, but the problem might be deeper.