WordPress.org

Support

Support » Plugins and Hacks » Plugin breaks image captions when saving two times

Plugin breaks image captions when saving two times

  • Hi!

    When I insert an image with caption and link, this shorttag is generated:

    [caption id="attachment_22" align="alignright" width="300"]<a href="image-url"><img src="thumbnailurl" alt="Test-Caption" width="300" height="199" class="size-medium wp-image-22" /></a> Test-Caption[/caption]

    When saving the post for the first time, the shorttag is changed to this:

    [caption id="attachment_22" align="alignright" width="300"][<img src="thumbnailurl" alt="Test-Caption" width="300" height="199" class="size-medium wp-image-22" />][1] Test-Caption[/caption]
    
    [...]
    
     [1]: imageurl

    This displays just fine. But when saving the same post again, this markdown is generated:

    [caption id="attachment_22" align="alignright" width="300"][<img src="thumbnailurl" alt="Test-Caption" width="300" height="199" class="size-medium wp-image-22" />][1][1] Test-Caption[/caption]
    
    [...]
    
     [1]: imageurl

    Notice the double [1][1] – The second [1] is inserted into the caption.

    Regards,
    Jost

    http://wordpress.org/plugins/wp-markdown/

Viewing 1 replies (of 1 total)
  • I’ve had the Markdown processor mess with my shortcodes too. Gets to be annoying sometimes. The author’s recommended workaround is to wrap the shortcode in a div element, like so:

    <div>[caption id="attachment_22" align="alignright" width="300"]<a href="image-url"><img src="thumbnailurl" alt="Test-Caption" width="300" height="199" class="size-medium wp-image-22" /></a> Test-Caption[/caption]</div>

    As a rule, Markdown will not do anything inside block elements. So this simple workaround should prevent the processor from mucking around with your caption shortcodes.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin breaks image captions when saving two times’ is closed to new replies.