Open lkraav opened 5 years ago
Original commit is https://github.com/Automattic/sensei/commit/6d9d7cdb5f8be9b7912e1538b3cf5764b741fb1b from 5 years ago. @danjjohnson do you happen to remember anything about it?
i'm having a similar issue, but i do not use Nav Menu Roles plugin. The warning occurs when all plugins are disabled except for Sensei LMS and Orbitfox Companion and on the Menu Editor page. In the menu editor page, Orbitfox Companion attempts to show the menu and triggers the filter which subsequently gets some weird menu object that has no ID value and throws these warnings.
I wasn't able to reproduce this with the Nav Menu Roles plugin, but was able to with the OrbitFox plugin.
In menu editor, Sensei is passing weird objects into
wp_setup_nav_menu_item
filter.https://developer.wordpress.org/reference/functions/wp_setup_nav_menu_item/ clearly states: "object_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories."
Instead, this is what Sensei sends:
Then PHP Notices occur when filter callbacks are expecting a real ID property to exist https://github.com/helgatheviking/Nav-Menu-Roles/blob/1.9.2/nav-menu-roles.php#L422
Steps to Reproduce
/wp-admin/nav-menus.php
[20-Nov-2018 12:42:38 UTC] PHP Notice: Undefined property: stdClass::$ID in wp-content/plugins/nav-menu-roles/nav-menu-roles.php on line 422
What I Expected
No weirdness
What Happened Instead
Weird objects transmitted
PHP / WordPress / Sensei version
7.2 / 4.9.8 / 1.12.2
Screenshot / Video
Context / Source
Full stack:
Must investigate https://github.com/Automattic/sensei/blob/version/1.12.2-beta.1/includes/class-sensei-admin.php#L1638