Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #57169, comment 10


Ignore:
Timestamp:
01/05/2023 10:07:24 PM (2 years ago)
Author:
azaozz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #57169, comment 10

    initial v1  
    99Looking at Polylang (https://github.com/polylang/polylang/blob/3.3/frontend/frontend-nav-menu.php#L134), the language code is appended to `$menu_item->ID` and it becomes a string, but `$menu_item->menu_item_parent` is not changed/remains numeric. So using `intval()` reverts the $menu_item->ID back to being numeric and it can be compared to menu_item_parent.
    1010
    11 I may be missing something but thinking this is the desired behaviour. Or does Polylang also append the language code to the `$menu_item->menu_item_parent`?
     11I may be missing something but thinking this is the desired behaviour.
     12
     13Edit: ah, scratch that, think I see what's going on. When appending the language codes Polylang also may overwrite `$menu_item->menu_item_parent` to be the same as the initial `$menu_item->ID`. In that case comparing would be best as strings.
     14