Log1x/navi

Add type and object properties to menu item stdClass

slobich opened this issue · 2 comments

Hey. Great library.

Any chance of adding type and object properties to the list of attributes so they get passed down from the original menu WP_Post object?

I'm working on a project where I need to change the the URL and appearance of links based on their target. I can do most of it by checking the classes property but some of the classes are being removed here so it doesn't cover all of the scenarios. For example if the target is a page the classes property is empty since they get removed since those classes are in the $disallowedClasses property.

I can do a PR but I just wanted to check if this request makes sense to you.

Thnx.

Log1x commented

I don't recall what those properties look like but that should be fine. Feel free to open a PR.

They get added with wp_setup_nav_menu_item() function. They both have info about the actual item the menu item is linking to. For example if the link is for a page the type property will be post_type and the object property will be page.

I'll go ahead with creating a PR and get back to you then.

Thank you.