Adding a unique ID to each sub-menu
As far as I can know about menus in WordPress – handlers use menu arguments. You can try to use this. Using the argument filter, we can pass the ID of the item: add_filter( ‘nav_menu_item_args’, function( $args, $item, $depth ) { $args->item_id = $item->ID; return $args; }, 10, 3 ); Then use custom argument anywhere. … Read more