Wordpress - Add Title Attribute to WordPress Image the_post_thumbnail

You can do that because you can add all the attributes you need:

the_post_thumbnail( 'large', array( 'title' => get_the_title() ) ); 

Please read on in the Function Reference of the_post_thumbnail.


As per the Codex entry for the_post_thumbnail(), you can pass an attributes array as a parameter:

<?php the_post_thumbnail( $size, $attr ); ?>

So you would just need to define the array; here's the Codex example, modified to include the title attribute:

$post_thumbnail_attr = array(
    'src'   => $src,
    'class' => "attachment-$size",
    'alt'   => 'alt here',
    'title' => 'title here',
);

...which you could then pass to the_post_thumbnail():

the_post_thumbnail( 'large', $post_thumbnail_attr );