WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Post Thumbnails
[resolved] Caption (3 posts)

  1. Gregg Franklin
    Member
    Posted 1 year ago #

    How can I display the caption for the newly created feature image?

    http://wordpress.org/extend/plugins/multiple-post-thumbnails/

  2. alexros
    Member
    Posted 1 year ago #

    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!

  3. Chris Scott
    Member
    Plugin Author

    Posted 1 year ago #

    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);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic