WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Caption

[Resolved] 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
    Member

    @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 ‘[Resolved] Caption’ is closed to new replies.