wp_nav_menu add class to the “a” in WordPress

Please add below code inĀ functions.php

add_filter( ‘nav_menu_link_attributes’, ‘aviweb_menu_add_class’, 10, 3 );

function aviweb_menu_add_class( $atts, $item, $args ) {
$class = ‘anc-nav-link’;
$atts[‘class’] = $class;
return $atts;
}

Advertisements