You have the elements of the $args
array from wp_nav_menu()
available. You can use them with the wp_nav_menu_args
filter. In your case you probably want to use theme_location
or menu
. Exemplary usage:
add_filter( 'wp_nav_menu_args', 'check_for_args_element' );
function check_for_args_element( $args ) {
if ( $args[ 'theme_location' ] == 'main' ) {
// code
}
return $args;
}