Support » Fixing WordPress » WP adds paragraph tags to images

  • I’m troubleshooting why WP adds paragraph tags to my html code for images. I’m sure others have experienced this, I just can’t find any relevant posts on this topic. Could anyone point me in the direction of an explanation for this phenomenon? Site reference:

    It’s frustrating when an application changes or adds to your code without any warning. It causes the pages to fail validation. Much thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • you are talking about the opening and closing <p> tags around your images?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Because the IMG element is an inline element, not a block element, and it cannot be in the page unless it is inside block level tags.


    <p> Stuff </p>
    <img src="whatever" />
    <p> more stuff </p>

    Is invalid HTML. Has been since at least HTML 4.0. You have to put the IMG inside a P or a DIV or something. It must be inside a block, or it’s invalid code.

    The validation error on your page is not that img is inside a p, it’s that the p is not closed before the h3 starts. Wrap your imgs in divs or p’s to correct the problem.

    How, specifically, are you adding your images?

    Are you writing the <img src=... into the post textbox? If so, are you using the code tab or the visual tab?

    If you are using the code tab, are you using the image quicktag button?

    Or are you using the the upload function on the posting screen?

    nm my posts, otto is better 🙂

    Thread Starter duanelc


    Can’t believe I missed that one. That indeed fixed it. You guys were a lot of help. Much thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP adds paragraph tags to images’ is closed to new replies.