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. This link title attribute appears as tooltip when a link in the menu is hovered, to give little information about the link. A good thing actually.

Remove Title Attribute from WordPress Menu Link

But in my recent theme, the attribute and its tooltip disturbed jQuery dropdown menu I created. So I needed to remove the title attribute from the menu.

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

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

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

Put the code in your theme funtion.php and no more title attribute in the menu.
Thanks to Mark / t31os and inspirationally at

23 Comments to “Remove Title Attribute from WordPress Menu Link”

Add Comments (+)

  1. Vivek Parmar says:

    thanks for sharing it. One question though does it work in thesis theme as i’m customizing it and want to remove title attribute

  2. Ralph says:

    “Put the code in your theme funtion.php”

    Can you explain/show where/how exactly to insert this bit of code?

    Thank you

  3. Tom says:


    I just bumped into the same problem, but I chose to remove the attribute via jQuery, like so in the header.php :

    $(function() {
    $(“#header a”).removeAttr(“title”);

    Note that this one works only for the main menu.
    Reason for doing so was that you solution (althought it should be working), printed a line in my theme with the regexp.

    Anyway: thanks for sharing!


  4. Ralph says:

    Thank you for the share and the info Reza & Tom.

  5. stewie says:

    After 2 hours I found this article…..THANKS!!

    • reza says:

      @Ralph, n @Stewie, glad this article helps :)

      @Stewie, I see You are using it for your category dropdown menu

      @Tom, thanks for sharing your solution :)

  6. Quentin says:

    Thank you so much for sharing! I was about to get crazy with those god damn titles!

  7. E Gorman says:

    perfect! I’ve been banging my head on the wall for a good hour trying to remove this.

  8. Jason Gill says:

    This has bothered me for drop menus for some time. Thanks for the solution. Brilliant.

  9. Mark Raymond says:

    guys, what if my nav menu doesnt have title tag and i want to add title tag.
    pls help

  10. Mark says:

    Thanks Mate! Your code just made my day :-)

  11. Alan says:

    Could you adjust this to remove the title attribute from images?

  12. freshmaker says:

    that’s great, thank you so much..

  13. says:

    Nice solution! I needed that for my solution.

  14. danilo says:

    thanks a lot….i’m using your solution in a
    3.2 WP site.
    Is it possibile to ‘remove’ that unwanted effect
    from archives too?
    See you soon!

  15. Tom Launder says:

    Thanks for the code. Worked perfectly. Title tags on menu items were ruining the drop-down navigation.

  16. Ayu says:

    Thank you so much, it works perfectly!

  17. JokeVandeFliert says:

    briljant! Before I was using the Remove tittle attribute plugin, but that gave me an unwanted problem.
    This simple addition to my functions solved my problem :)
    I just added one extra line to remove some more titles :)
    add_filter( ‘the_category’, ‘my_menu_notitle’ );

  18. Soni Sharma says:

    Ohho! It doesn’t work for me I am using Geo Places Theme and I am putting huge description in categories. it shows long lines in view source….not good for SEO

  19. Debbie says:

    Just the solution I was looking for and it still works (June 1, 2013).


  1. How to Order Categories by Most Recently Updated
  2. Shun the Plugin: 100 WordPress Code Snippets from Across the Net | WordPress, Multisite and BuddyPress plugins, themes, news and help –
  3. Remove Anchor Title in Menu « Patrick Hannon
  4. 70 Excellent WordPress Tips And Tutorials From First Three Months Of 2011 | stylishwebdesigner
  5. 100 WordPress Code Snippets from Across the Net « Tech Snippets

Leave a Reply


Amazingly Beautiful WordPress Themes