Support » Fixing WordPress » Cursor position after inserting captioned image

  • I’m using a modified TwentyTen theme on my blog. When an image is inserted using the visual editor and the image has a caption the editor text entry position is at the end of the caption rather than just after the image. So, if you start typing your text is added after the caption, if you add another image the second image appears inside the box containing the first image with some very nasty visual effects. Is this the normal behaviour? I would have thought that, after inserting an image captioned or un-captioned, the text entry point should be outside and after the box containing the image.

    I hadn’t noticed this until my wife added a blog entry and asked me to proof read it. We have different writing styles and I’m not sure what I normally do that has caused me not to see this before.

    Despite joining this forum I’ve been running a WordPress blog on either a self hosted machine, or a commercial hosted service but my installation, for several years. I normally don’t ask for help but this has me stumped!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Post a link so I can see what you mean. although it sounds like normal behavior. If so, there are ways around it I’m sure.

    Here is a link to a page showing the issue

    I inserted the first image then, without typing anything into the visual editor inserted the second image. Is this a bug or a feature? Either way is there a way to ensure that the insertion point is always after an image rather than at the end of the caption?

    can you post the image code exactly as exists in the html editor?

    if more than 10 lines use patebinthen post the link.

    [caption id="attachment_2338" align="aligncenter" width="224"]<img class=”size-medium wp-image-2338″ title=”Mystery being solved” src=”×300.jpg” alt=”” width=”224″ height=”300″ /> Mystery being solved.
    <div class=”mceTemp mceIEcenter”><dl id=”attachment_2340″ class=”wp-caption aligncenter” style=”width: 310px;”><dt class=”wp-caption-dt”><img class=”size-medium wp-image-2340″ title=”Odd Block” src=”×224.jpg” alt=”” width=”300″ height=”224″ /></dt><dd class=”wp-caption-dd”>This block had to be corrected.[/caption]

    As you can see the HTML is messed up. What is the [/caption] doing inside the last dd tag?

    Drew Jaynes


    WordPress Core Developer

    This is a known issue. There’s a ticket for it on the WordPress Trac: #19389.

    this is how my code looks, looks like you don’t have the closing caption tags?

    [caption id="attachment_92" align="alignnone" width="260"]<a href="" rel="attachment wp-att-92"><img src="" alt="" title="003 (2)" width="260" height="300" class="size-medium wp-image-92" /></a> this is a caption[/caption]
    text below the caption image
    [caption id="attachment_91" align="alignnone" width="300"]<a href="" rel="attachment wp-att-91"><img src="" alt="" title="001-001" width="300" height="254" class="size-medium wp-image-91" /></a> this is another caption[/caption]
    more text below another caption image

    live demo

    Exactly, it looks like a bug to me but I’m not sure where it is, how it got introduced, and if it’s unique to my site.

    Basically the reproducible way to get it is to insert one image then insert a second one without typing anything into the editor. If you hit return between inserting the first and second image then the problem goes away.

    If you don’t have that behavior then I’ll go away and dig deeper into my setup. I did have some editor related plugins installed but they have been deactivated for some time because I didn’t know if they were compatible with the latest WordPress. It may be that one of them has left something corrupted.

    If you look at the code that got generated the first image has a proper caption tag:

    [caption id="attachment_2338" align="aligncenter" width="224"]

    while the second image has tags:

    <div class="mceTemp mceIEcenter"><dl id="attachment_2340" class="wp-caption aligncenter" style="width: 310px;"><dt class="wp-caption-dt">


    Thanks for the help so far. I’ll have time to rummage in the code tomorrow and let you know what I find.


    indeed, in the visual editor, if I insert one image from the media uploader, then repeat with another, without typing into the field, I loose the caption on the first image, but get the second.

    if I go to html after, this is what I see:

    <a href="" rel="attachment wp-att-91"><img class="size-medium wp-image-91" title="001-001" src="" alt="" width="300" height="254" /></a>
    <dl id="attachment_92" class="wp-caption alignnone" style="width: 270px;"><dt class="wp-caption-dt"><a href="" rel="attachment wp-att-92"><img class="size-medium wp-image-92" title="003 (2)" src="" alt="" width="260" height="300" /></a></dt><dd class="wp-caption-dd">this is a caption</dd></dl></div>

    shoves it all into a single div, If I do the same in the html editor, it’s fine. I never use the visual editor, so never knew about this.

    Sirs, I am having exactly the same issues.
    I am using the media library to insert my images into a post
    Inserting an image with caption and the cursor is in the grey caption box and I cant get it out to insert the next photo.
    If i do insert it stays in the caption box.
    I am new at wordpress and themes – so please be patient!!
    I am using Imbalance (not imbalance 2) and firfox as my browser.
    it is so frustrating since I want to go live and I’m a photographer, using wordpress as a photographic blog.
    Any help will be greatly appreciated



    Forum Moderator

    Please post your own topic.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Cursor position after inserting captioned image’ is closed to new replies.