How to always add caption element to images – even if empty?
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; … Read more