thebatclaudio / wp-rest-api-v2-menus

Adding menus endpoints on WP REST API v2
47 stars 22 forks source link

Push children based on ID rather than post_name #13

Closed NHollmann closed 5 years ago

NHollmann commented 5 years ago

Reason

I've found a bug corresponding children of 'individual links'. If an individual link have a child, it is not in the REST response. The reason is that their post_name is not set to an ID but to a custom name based on the label of the item.

Changes

Changed the comparison to link children to their parents. Now the $child->menu_item_parent is compared to strval($item->ID). I found no official documentation on wich field should be compared to menu_item_parent but the ID seems fine. There are some user contributions which use the ID.

thebatclaudio commented 5 years ago

Hi, thank you for your pull request. I will release a new version of the plugin ASAP with your contribution.

thebatclaudio commented 4 years ago

Hi @NHollmann, if you send me your Wordpress.org username I'll add you in plugin's contributors!