I have the same issue which I can see has not been replied to??
And to answer my own question 🙂 in case anyone else is trying to figure this out..
add_filter('img_caption_shortcode', 'gn_caption_shortcode_filter',10,3);
function gn_caption_shortcode_filter($val, $attr, $content = null)
{
extract(shortcode_atts(array(
'id' => '',
'align' => 'alignnone',
'width' => '',
'caption' => ''
), $attr));
if ( 1 > (int) $width || empty($caption) )
return $val;
if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . (int) $width . 'px">'
. do_shortcode( $content ) . '<div class="wp-caption-text">' . $caption . '</div></div>';
}
Im using gtmetrix by the way^
Thanks, I just posted it there.