Make WordPress Core

Ticket #14380: 14380-filter.2.diff

File 14380-filter.2.diff, 737 bytes (added by iandunn, 11 years ago)
  • src/wp-includes/media.php

     
    652652
    653653        if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
    654654
    655         return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . (10 + (int) $width) . 'px">'
     655        $caption_width = apply_filters( 'caption_width', ( 10 + (int) $width ) );
     656        $caption_width = $caption_width ? ' style="width: ' . $caption_width . 'px"' : '';
     657
     658        return '<div ' . $id . 'class="wp-caption ' . esc_attr( $align ) . '"' . $caption_width . '>'
    656659        . do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';
    657660}
    658661