Can we change the title and alt attributes of the_post_thumbnails and set them to post title instead ? like creating a function for it and adding a filter ? I tried searching but I can't seem to find what I want.
and thanks in advance.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
second argument in this function you can set a few set fields, such as alt, title, source and class:
$default_attr = array( 'src' => $src, 'class' => "attachment-$size", 'alt' => trim(strip_tags( wp_postmeta->_wp_attachment_image_alt )), 'title' => trim(strip_tags( $attachment->post_title )), );