How to Remove Title Attribute from WordPress Menu Link

by • On Dec 12, 11 0:04am, Updated: Feb 3, 12 5:16am • 2388 Views

If you are a WordPress theme developer or designer, you know how distracting it is when the “title” tooltip pops up while hovering through menu items. Especially if you are using dropdown menu system, this tooltip could be really annoying.

Recently, I was working on few WordPress theme, which are going to be released publicly very soon. However, while testing these themes on my local server I found these tooltips to be a very disturbing issue. As a developer, I already know that some basic WordPress functions like wp_page_menu(), wp_nav_menu() or wp_list_categories() can be used to show the page or categories item on navigation system. That’s exactly where our “title tooltip” issue relies on. Let’s not forget that “tooltip” is a default function. So, in order to remove that we have to force it through certain snippet code.

Tooltip on WordPress menuI read so many articles on this & found numerous way of removing tooltip from the navigation system. I am sorry but some of them went little too deep for this simple issue. All I had to do is to add a little snippet code on my theme’s functions.php file, that’s it.  Now, the question is,”What If you don’t have this functions.php file at all?”. The answer of this question is, you have to create a functions.php file. Now, copy & paste the following snippet code on your newly created( if you didn’t had any) functions.php file & update it. That’s it.

function remove_title( $menu ) {
return $menu = preg_replace('/ title=\"(.*?)\%u201D/', ", $menu ); }
add_filter( 'wp_nav_menu', 'remove_title' );
add_filter( 'wp_page_menu', 'remove_title' );
add_filter( 'wp_list_categories', 'remove_title' );

This code should work perfectly, at least it worked on this site. If for some reason you couldn’t make it work, feel free to ask any question on our comment section. I will get back to you ASAP. If you have any better idea, just drop us an email with your tips. Thanks.

You can follow us on Twitter, add on your Google+ circle or Like our Facebook page to get the latest news, updates and reviews.

Posted in: WordPress Tags: , , ,