Ticket #8256: media_img_caption_shortcode_no_alt.diff
| File media_img_caption_shortcode_no_alt.diff, 1.3 KB (added by , 17 years ago) |
|---|
-
wp-includes/media.php
568 568 * The supported attributes for the shortcode are 'id', 'align', 'width', and 569 569 * 'caption'. 570 570 * 571 * If the image's alternative text is identical to the caption text, the alt 572 * text will be removed (as alt="") unless you pass TRUE via the 573 * 'wp_img_caption_print_duplicate_alt' filter hook 574 * 571 575 * @since 2.6.0 572 576 * 573 577 * @param array $attr Attributes attributed to the shortcode. 574 578 * @param string $content Optional. Shortcode content. 579 * @uses apply_filters() Calls 'img_caption_shortcode' filter 580 * @uses apply_filters() Calls 'wp_img_caption_print_duplicate_alt' filter 575 581 * @return string 576 582 */ 577 583 function img_caption_shortcode($attr, $content = null) { … … 593 599 594 600 if ( $id ) $id = 'id="' . esc_attr($id) . '" '; 595 601 602 if ( ! apply_filters( 'wp_img_caption_print_duplicate_alt', false ) ) { 603 // alt text is removed if identical to printed caption 604 $content = str_replace( sprintf( 'alt="%s"', esc_attr($caption) ) 605 , 'alt=""', $content ); 606 } 607 596 608 return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . (10 + (int) $width) . 'px">' 597 609 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>'; 598 610 }