(1) I used the code given on answer to How to use logout function on custom menu link?
to programmatically add a menu element to wp_nav_menu_objects
(Say "Animals"). I give it an id, say 1000.
(2) Similarly, I succesfully created elements that I wanted to be children of a preexisting element (fixing menu_item_parent
to the id of the parent element) (like "Jonquil" to element "Flowers")
(3) The problem comes when I try to add children elements (Say "Cats" and "Dogs") to my programmatically added element "Animals". Cats and Dogs appear on the same level as Animals, as if WP couldn't manage to find their parent... (Yes, I do 3 after 1...)
An idea of what I can be missing ?