Add custom attributes to menu items without plugin
Filter nav_menu_link_attributes: add_filter( ‘nav_menu_link_attributes’, ‘wpse_100726_extra_atts’, 10, 3 ); function wpse_100726_extra_atts( $atts, $item, $args ) { // inspect $item, then … $atts[‘custom’] = ‘some value’; return $atts; } This works with WordPress < 3.6: add_filter( ‘walker_nav_menu_start_el’, function( $item ) { $parts = explode( ‘>’, $item ); $out = array (); foreach ( $parts as $i => … Read more