Removing “Title” Attribute from Menu Link

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.

I 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=\"(.*?)\"/', '', $menu );

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.

Today In History




  1. Chris HammondPublished: 3 years ago

    Doesn’t work – badly formatted code 🙁
    Crashes my site.

    • Iftekhar BhuiyanPublished: 3 years ago

      Hello Chris, I am sorry to hear that this snippet causes your site to crash. I tested this snippet few minutes back just to respond to your comment. This snippet is absolutely fine and still works like charm. Thank you.

Leave a Reply

Note: Convet HTML, PHP, JavaScripts from HTMLify, before posting from comment section.
License: By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution. Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.