Support » Themes and Templates » Remove alt text on navigation links?

  • Hi,

    I’d like to know whether it’s possible to remove the alt text that shows up when I hover my mouse across a navigation link in the header?

    When I look at header.php, I get:

    <?php wp_list_pages('title_li=&depth=1'); ?>

    Can anyone tell me how to edit the file that generates the page links so I can go into it and remove any ‘alt’ or ‘title’ instances that show up when the links are genereated?

    Thanks, Tom

Viewing 4 replies - 1 through 4 (of 4 total)
  • Okay made a little inroad into this..

    I found out the classes.php is what handles the output of wp_list_pages, and this is what it looks like (i hope):

    $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . esc_attr(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';

    Now, I’ve tried removing the ‘title’ instances, but that screws up the links. It gets rid of the alt tag, sure, but when clicked on gives me a 404.

    Which part of the code do I need to modify to remove the title=”” and/or alt=”” classes?


    Just to clarify further, this is what I’m trying to do. Let’s say I’ve got an ordinary link being rendered with HTML:

    <a href="#" class="link" title="#">

    I’m trying to remove the title=”” bit from it, so that when I hover my mouse over a link, it doesn’t display the little yellow box. But it’s not presented as it is above, since it’s generated through PHP which I know nothing about!

    Sorry to triple post, not for means of bumping merely developing the info so I can find a solution as quickly as possible, if there is one : )



    Forum Moderator

    title="' . esc_attr(apply_filters('the_title', $page->post_title)) . '"

    if you remove exactly this snippet from the code you posted, you should be ok.

    however, editing core files is not considered ‘good practice’ as you need to repaet it with every update.


    Thank you so much! Very helpful and informative post.

    I downloaded the plugin, which worked perfectly, as opposed to changing code manually, and then did some research and found a similar one for image title attributes: when I was asked to “get rid of the annoying little yellow boxes” from every image on the website (+200 photos..) saved me hours of mind numbing work!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove alt text on navigation links?’ is closed to new replies.