Removing Title Tag from Thumbnails

This filter will remove it completely from all images, you can add a conditional to only effect certain images.

function remove_img_title($atts) {
    unset($atts['title']);
    return $atts;
}
add_filter('wp_get_attachment_image_attributes','remove_img_title');

Instead if you want to use <?php the_post_thumbnail( 'category-thumb' ); ?>

You can pass it an empty title using the second $attr so your title tag will look like title=" ".

It would be:

$default_attr = array('title'   =>  ' ');
the_post_thumbnail('post-thumbnails', $default_attr);

Leave a Comment