This was killing me, no matter what I did I couldn’t get rid of an extra (empty) set of P tags being generated at the top of my post where I had inserted an image and caption (floating right).
I tried disabling all my plugins and still the caption DIV was being wrapped in paragraph tags – which would then be forced out of the P tags, leaving them sitting there empty at the top of every post.
Otto42’s example post didn’t help, because he had a couple lines of text before the image was displayed – and I was looking to put the image right at the top of the post.
Solution: On a whim I decided to throw a couple extra line breaks in and see what happened – sure enough, worked like a charm.
So, if anyone else happens to have trouble with this – in the HTML editor, make sure you put a full empty line between the caption code and your initial paragraph:
Like:
[caption id="attachment_5" align="alignright" width="330" caption="Mmmm... that looks tasty."]<img class="size-full wp-image-5" title="food" src="https://example.com/wp-content/uploads/2009/02/food.jpg" alt="Mmmm... that looks tasty." width="330" height="200" />[/caption]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ornare accumsan turpis. Donec hendrerit metus non elit. Morbi egestas, lorem sed congue consectetur, pede turpis ornare urna, quis congue urna orci eget lectus. Maecenas sit amet augue a enim eleifend placerat. In cursus varius ante. Sed velit dui, sodales nec, pharetra in, accumsan a, nibh.
Hope that helps someone.