Text Wrapping With Images And Captions Is Broken

Skip to content
WordPress.org

Forums

  • Welcome to Support
  • Guidelines
  • Get involved
  • Log in
  • Welcome to Support
  • Guidelines
  • Get involved
  • Log in
Skip to content

Home / Plugin: Classic Editor / Text wrapping with images and captions is broken

Search for: Search forums
  • bluedogranch

    (@bluedogranch)

    5 years, 6 months ago

    This plugin does appear to be broken after the last WP update. Adding an image in the middle of a paragraph will correctly wrap text around the image with left or right alignment. But adding an image with a caption breaks the text wrap because a closing </p> is added right before the [caption opening; and in page source, the </p> tag is added right before the <figure opening tag. This is with WP 5.2, twentynineteen and no other plugins than Classic Editor.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Andrew Ozz

    (@azaozz)

    5 years, 6 months ago

    Could you give some more info how to reproduce this please 🙂

    – Are you using only the classic editor or was the post started in the block editor and then edited in classic? – Any chance there is some code pasted in the theme’s functions.php (or another place) that was used to disable autop? – If this is a test site, can you try reproducing with another theme.

    Thread Starter bluedogranch

    (@bluedogranch)

    5 years, 6 months ago

    Thanks, this was a new post started in the Classic editor on an unmodified copy of twentynineteen.

    And after I publish the post, I can switch to the Genesis sampele theme and twentysixteen and the display is the same with the closed p tag breaking the caption.

    However, if I then edit that same post and add another image with a caption in a paragraph below the first, it does not include the closing p tag that breaks the wrap.

    So adding the first image with a caption results in a broken wrap, but adding another image with a caption further down the post does not. Adding an image and caption above the first one does result in a broken wrap.

    And, this is strange: this continues with multiple images and captions added to the top of the post; the top image caption is broken, but the ones below “fix” themselves with the p tag that breaks the wrap being automagically removed.

    Plugin Author Andrew Ozz

    (@azaozz)

    5 years, 6 months ago

    Hmm, I still cannot reproduce this. The Twenty Nineteen theme replaces the default HTML for images with captions to <figure> and <figcaption>, but I don’t see any “stray” P tags.

    Typing

    123 [caption id=...]<img class... /> test[/caption] 456

    results in

    <p>123</p> <figure id=...><img class... /><figcaption ...>test</figcaption></figure> <p>456</p>

    The text 123 and 456 is properly “split” by the figure tag (figure is a block-level tag, cannot be inside of a <p>).

    This sounds like something to do with autop or parsing the caption shortcode, but… Don’t see any errors here.

    • This reply was modified 5 years, 6 months ago by Andrew Ozz.
    Thread Starter bluedogranch

    (@bluedogranch)

    5 years, 6 months ago

    It is strange. I’m adding a long paragraph of text, and then clicking in the middle and adding media from the button in the text (not visual) editor. So I’m not typing in the caption and image block, or copy/pasting it; I’m letting the media button insert it.

    Thread Starter bluedogranch

    (@bluedogranch)

    5 years, 6 months ago

    And, since I can add more images with captions and the p tag gets removed, it’s something with the way WordPress handles p tags when saving the post.

    Plugin Author Andrew Ozz

    (@azaozz)

    5 years, 6 months ago

    it’s something with the way WordPress handles p tags when saving the post.

    Yeah, looks like that is “broken” somewhere… Very hard to find it if the error cannot be reproduced consistently. Will keep trying 🙂

    For now perhaps try splitting the long paragraph before adding an image with a caption (press Enter twice, then up arrow to move to the empty paragraph, then insert the image). That seems to always work properly.

    karunaray

    (@karunaray)

    5 years, 6 months ago

    I’ve the exact same problem, noticing more with old posts. Will have to test mindfully with a new post. After reading this, I removed the caption for the image in the post I’m editing and voila the alignment now works. With caption alignment is broken. Happened on another old post. All written in TincyMCE the best plugin, always updated. When this block thing happened I asked you and you said keep using it with classic editor. So that’s what I’m doing and now noticing this. Please let me know what other info you may need or testing… I only just looked at settings for TinyMCE and my post editor is same as it’s always been so I’m guessing it’s not in block mode.

    karunaray

    (@karunaray)

    5 years, 5 months ago

    Very surprised there’s been no answer. You always answer!

    karunaray

    (@karunaray)

    5 years, 5 months ago

    Definitely a problem. Creating a new post and the image, as soon as a caption is used alignment goes out the window. Makes it really hard to give credit or title of image. Something didn’t transition well here with the block editor WP big update, which I’m not using but need answers…

    Hedley

    (@hedley)

    5 years, 1 month ago

    This happens to me consistently. Add an image anywhere in a post with left or right alignment, and it works fine, until you add a caption to the image, then the alignment breaks. Disable Classic Editor, and it works as it should.

    I’m not sure if it’s a WP problem or a plugin problem, but perhaps a useful option would be a setting that allows me to choose whether I want to use Classic Editor on a post. Thus, I could disable it when I need aligned images with captions.

    Or, maybe this will just be the thing that finally forces me to suck it up and use Gutemberg, despite my revulsion for it. .

    karunaray

    (@karunaray)

    5 years, 1 month ago

    I don’t have revulsion for Gutenberg. What I have is no time for yet another learning curve. So I left my backend the way it is. This plugin author has always updated and responded, except this widespread issue that’s under-reported. It’s BEYOND ANNOYING. Basically breaks WP! I’m not saying it’s the plugin, but the powers that be REALLY need to address it. Disappointed in that no one at WP is addressing this!

    Hedley

    (@hedley)

    5 years, 1 month ago

    Maybe “revulsion” was a bit strong, but I’m definitely under-enthused by Gutenberg. I’m not one of those people who’s automatically against change – I generally use new things for a while, even if I’m initially disappointed, and eventually I usually come around. However, I cannot seem to get past the fact that all the post-editing tools that I’m used to having easily at hand on one editing screen now have to be accessed by clicking into different sub-sections. Gutenberg slows me down and provides little benefit in return (for the type of content I typically work with, at least). Maybe it will eventually get somewhere better, but when I want or need block capability for pages (I almost never need blocks when I’m creating posts), I’ll use Beaver Builder, which is light years ahead of Gutenberg. Really, there should be away to disable Gutenberg for post types built in.

    I wouldn’t hold your breath waiting for the powers that be at WP to help make Classic Editor work; they want people to use Gutenberg, I can’t imagine that that have any interest in helping people avoid it.

    jockturner

    (@jockturner)

    5 years ago

    Any update on this?

    My client has ben using the ‘Classic Editor’ now for some time and has reported to me that some of his images are not being centered – it didn’t take me long to see that it was those with captions that were failing to align.

    We can’t be the only sufferers!

    There must be a fix out there??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Text wrapping with images and captions is broken’ is closed to new replies.
  • Classic Editor
  • Frequently Asked Questions
  • Support Threads
  • Active Topics
  • Unresolved Topics
  • Reviews

Tags

  • caption
  • centered
  • image
  • In: Plugins
  • 13 replies
  • 1 participant
  • Last reply from: jockturner
  • Last activity: 5 years ago
  • Status: not resolved

Từ khóa » Html Wrap Text Around Image With Caption