Wordpress get display location in nav_menu_submenu_css_class filter

Viewed 535

Maybe I am thinking about this too much. Hopefully I am not. I would like to add a class dropdown-menu animated to all sub menus in the wp_nav_menu that are in a particular location without using a walker. I realise there is a filter for this called nav_menu_submenu_css_class but I am unable to determine the location of the menu. This is my code;

function mi_submenu_css( $classes, $args, $depth )
{
    print_r ($args); echo "JTGO";
    /*if ('header-menu' === $args->theme_location) {*/
        $display_depth = ($depth + 1);
        array_push($classes, 'dropdown-menu animated fadeOutUp menu-depth-' . $display_depth);
    /*}*/
    return $classes;
}

I expected $args to contain the menu location but comes back empty. You can see I have tried to print it out as an array.

1 Answers
Related