Add aria menuitem to WordPress menu links

// Add correct aria role to menu items. function menu_add_atts( $atts, $item, $args ) { $aria = 'menuitem'; // or something based on $item $atts['role'] = $aria; return $atts; } add_filter( 'nav_menu_link_attributes', 'menu_add_atts', 10, 3 );

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.