How to Add WordPress Menu Title Attribute

When customizing your WordPress navigation menu, you may have noticed an option called the Title Attribute. While it’s often overlooked, this small feature can enhance both user experience (UX) and SEO.

WordPress

What Is the WordPress Menu Title Attribute?

The Title Attribute is an HTML attribute that lets you add additional information to a menu link. When users hover over a menu item, the title text appears as a tooltip.

For example:

  • Menu Label: Blog
  • Title Attribute: Read our latest articles and updates

When visitors hover over “Blog”, they’ll see that helpful tooltip.

Benefits of Using Title Attributes

  • Improves accessibility for users who rely on screen readers
  • Provides context about where a link leads
  • Can include relevant keywords (small SEO advantage)
  • Enhances overall navigation usability

How to Enable and Add a Title Attribute in WordPress Menus

By default, the title attribute field may be hidden in the WordPress Menu editor. Here’s how to enable and use it:

Step 1: Go to Menus in WordPress

  1. Log into your WordPress dashboard.
  2. Navigate to Appearance > Menus.

Step 2: Enable the Title Attribute Option

  1. In the top-right corner of the Menus screen, click on Screen Options.
  2. Under “Show advanced menu properties”, check the box for Title Attribute.

Step 3: Add a Title Attribute to Menu Items

  1. Expand any menu item by clicking the dropdown arrow.
  2. You’ll now see the Title Attribute field.
  3. Enter descriptive text (e.g., for a “Contact” menu item, you could write: Get in touch with our team).
  4. Click Save Menu to apply changes.

Example Use Cases for Title Attributes

  • Home → Title: Return to the homepage
  • Shop → Title: Browse our latest products
  • About Us → Title: Learn more about our story and mission

This makes your menu more informative and user-friendly.

SEO Considerations for Title Attributes

While title attributes can add context, they are not a major SEO ranking factor. However:

  • They can improve click-through rates (CTR) by making navigation clearer.
  • Use natural language and avoid keyword stuffing.
  • Keep text short (ideally under 60 characters).

Alternative: Add Title Attributes with Code

If you’re customizing your theme, you can add title attributes via code. For example, using wp_nav_menu filter:

function add_menu_title_attributes($atts, $item, $args) {
    if ($item->title == 'Blog') {
        $atts['title'] = 'Read our latest posts and updates';
    }
    return $atts;
}
add_filter('nav_menu_link_attributes', 'add_menu_title_attributes', 10, 3);

This adds a custom title attribute programmatically.

Leave a Comment