• I am working on building a custom Walker_Nav_Menu class for use in wp_nav_menu(). My issue is that I need to gain access to the $item->ID in start_lvl(), the same way you would in start_el().

    function start_lvl( &$output, $depth, $args ) {
    // You can not access $item here because it is not passed as an argument
    } 
    
    function start_el(&$output, $item, $depth, $args) {
    // You can access $item here
    }

    I am trying to pull metadata information for each menu item using its ID. I have seen a couple other threads where people have asked similar questions but I have not found a working answer.

    Any help would be much appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter yoxalld

    (@yoxalld)

    I still haven’t found a solution to this, does anyone know where I might be able to find more information?

    Thanks!

    Thread Starter yoxalld

    (@yoxalld)

    I am still at a loss on how to make this work. I have tried looking at what other properties the walker class has but I can’t find anything that will allow me to get any kind of ID within the start_lvl function. Any help would really be appreciated! Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to access Item->ID in custom walker’ is closed to new replies.