Remove Nav Menu Title Attribute

For accessibility purposes you can remove the default WordPress ‘title=’ attribute with the following code snippet.

Code Example

/**
 * Remove navigation menu title attribute.
 *
 * @param string $menu Menu.
 */
add_filter( 'wp_nav_menu', 'conversions_menu_notitle' );
function conversions_menu_notitle( $menu ){
  return $menu = preg_replace('/ title=\"(.*?)\"/', '', $menu );
}