I've got a default main menu:
wp_nav_menu();
But it gives a list of links in a form:
(...)
<a href="link" title="PageName">PageName</a>
(...)
The very important question is, how to force WP to display it like:
(...)
<a href="link">PageName</a>
(...)
I don't like the yellow boxes appearing every time I hover anything in menu.
I know it's possible, because I've seen it working, but no idea how? Filters maybe? Any ideas?
I've got a default main menu:
wp_nav_menu();
But it gives a list of links in a form:
(...)
<a href="link" title="PageName">PageName</a>
(...)
The very important question is, how to force WP to display it like:
(...)
<a href="link">PageName</a>
(...)
I don't like the yellow boxes appearing every time I hover anything in menu.
I know it's possible, because I've seen it working, but no idea how? Filters maybe? Any ideas?
The title is an accessibility attribute that helps users with screen readers. It is part of the recommended WC3 standard for navigation items. Just think about that before you decide to eliminate it because you find it annoying.
Rather than modifying the PHP code, you could think about removing it after it's loaded. It's very easy to do this with jQuery. First, add this to your functions.php
file:
wp_enqueue_script('jquery');
Next, in your site.js
file, add this code:
<script type="text/javascript" > jQuery(document).ready(function($){ $('.nav li a').removeAttr('title'); } </script>
Again, I don't really recommend doing this, but this is how to accomplish it.
I'm pretty sure if you clear the "Title Attribute" field in the Appearance > Menu
editor that the titles will be removed from the links:
I have had the same problem and I solve this via wp.
if you ( as like as me before ) cannot see the title attribute in wp menu, check this :
The accepted solution is a jQuery jerky solution. This is the Wordpress PHP solution:
Add to your functions.php this:
/* REMOVE TITLES ON MENU */
function my_menu_notitle( $menu ){
return $menu = preg_replace('/ title=\"(.*?)\"/', '', $menu );
}
add_filter( 'wp_nav_menu', 'my_menu_notitle' );