This works:
add_filter( \'disable_captions\', create_function(\'$a\', \'return true;\') );
function image_send_to_editor_2($html, $id, $caption, $title, $align, $url, $size, $alt) {
$width = \'auto\';
if ( preg_match( \'/width="([0-9]+)/\', $html, $matches ) ) {
$width = $matches[1] . \'px\';
}
$output = \'<div id="attachment-\' . $id . \'" class="wp-caption align\' . $align . \'" style="width: \' . $width . \';">\';
$output .= $html;
$output .= \'<p class="wp-caption-text">\' . $caption . \'</p>\';
$output .= \'</div>\';
return $output;
}
add_filter(\'image_send_to_editor\', \'image_send_to_editor_2\', 10, 8);