The default behavior when it comes to full-width images in posts is this:
- If you insert an image alone, this HTML structure is produced:
<p><img/></p>
- If you insert an image with a caption, the HTML structure is produced:
<figure><img/><figcaption/></figure>
For the sake of styling (I want to have larger margin around images compared to standard paragraphs), I'd like to get <figure>
in both cases, not just when there is a caption. How to do it?
Edit: one thing I noticed is that the behavior changes as soon as Visual and Text tabs are switched in the editor, i.e., even before previewing or saving the post. Maybe the correct solution would be to somehow force WordPress editor to always use the [caption]
shortcode no matter what.