Remove Title Attribute from Featured Image

If you have featured images (formerly post thumbnails) that aren’t named as well as they could be, it’s nice to remove the title attribute so that things like “header-large” don’t appear in the tool tips.

add_filter('post_thumbnail_html', 'remove_feat_img_title');
function remove_feat_img_title($img) {
    $img = preg_replace('/title="(.*?)"/','',$img);
    return $img; 

One thought on “Remove Title Attribute from Featured Image”

  1. Hey,

    After searching for some time I finally found this site – and this solution.

    Worked perfectly. Very much appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: