image_send_to_editor with shortcode only works in text tab
-
I would like all of my images to behave the same. I would like to add the caption shortcode around all images regardless of whether they have a caption or not. Using the image_send_to_editor filter I can add the shortcode, but it only works in the Text tab, when switching between tabs it is lost. Is there something I am missing?
add_filter('image_send_to_editor', 'add_image_caption', 20, 8); function add_image_credit($html, $id, $caption, $title, $align, $url, $size, $alt) { if (empty($caption)) { $html = '[caption id="attachment_' . $id . '" align="align' . $align . '"]' . $html . '[/caption]'; } return $html; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘image_send_to_editor with shortcode only works in text tab’ is closed to new replies.