将帖子标题插入缩略图链接的标题标签中

This is what I have and I am able to insert the Post Title into the title value of the thumbnail, but instead I want it to be inserted into the title value of the link that is wrapped around it.

add_filter('wp_get_attachment_image_attributes', 'my_img_title', 10, 2);
function my_img_title($attr, $attachment = null){
    $attr['title'] = get_post($title)->post_title;
    return $attr;
}

I hope this helps:

   <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >

    <!--Your Thumbnail tag goes here--->

    </a>