Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpdocs_filter_gallery_img_atts( $atts, $attachment ) {
- $attachment = get_post( $attachment->ID );
- if ( $caption = $attachment->post_excerpt) {
- $atts['title'] = $caption;
- }
- return $atts;
- }
- add_filter( 'wp_get_attachment_image_attributes', 'wpdocs_filter_gallery_img_atts', 10, 2 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement