Support » Plugin: Multiple Post Thumbnails » Caption

Viewing 2 replies - 1 through 2 (of 2 total)
  • The same for me, the images do not have attribute title=””, although i write it in caption field in Wp media manager. How can i add title to image???

    thank you in advance!

    Plugin Author Chris Scott

    (@chrisscott)

    You can use a WordPress core filter to do this:

    add_filter('wp_get_attachment_image_attributes', function($attr, $attachment){
    	$attr['title'] = trim(strip_tags( $attachment->post_excerpt ));
    
    	return $attr;
    }, 10, 2);

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Caption’ is closed to new replies.