Remove Title Attribute from WordPress Menu Link

By default, WordPress menu functions, like wp_page_menu(), wp_nav_menu() or wp_list_categories() display menu links with title attribute.

Here’s the code to remove it from wp_page_menu(), wp_nav_menu() and wp_list_categories() function: 

function menu_notitle( $menu ){
  return $menu = preg_replace('/ title=\"(.*?)\"/', '', $menu );

add_filter( 'wp_nav_menu', 'menu_notitle' );
add_filter( 'wp_page_menu', 'menu_notitle' );
add_filter( 'wp_list_categories', 'menu_notitle' );

Put the code in your theme funtion.php and no more title attribute in the menu.


Popular posts from this blog

Set limit wp_nav_menu

Conut document have children that are show in navigation