Support » Plugin: Lazy Load » Lazy Load and wpautop img wrap

  • I’m using a custom theme with no filters applied to the_content and noticed that there was extra spacing above any image that was floated within the post content. I narrowed down the issue to Lazy Load adding an extra p element around images within the_content.

    Example code without Lazy Load (default WordPress behavior):

    <p><img class="alignright" src="http://imageurl.com" />"Paragraph text that is wrapped to the left of the image floated to the right"</p>

    With Lazy Load activated, I get the below:

    <p><img class="alignright" src="http://imageurl.com" /></p><p>"Paragraph text that is wrapped to the left of the image floated to the right"</p>

    So, Lazy Load is wrapping the image in a separate set of p tags, which is different behavior than the default wpautop functionality. Obviously, this causes formatting issues and extra spacing within the post content, especially since any functions designed to remove wpautop from around images or to remove wpautop at all are ignored… I’m assuming it’s because there are content filters within the Lazy Load plugin that are replacing the default filter (?? – this is really just an assumption as I haven’t dug into the plugin code yet).

    Any thoughts on how to correct this behavior, or a function that can be applied directly to the Lazy Load content filters?

    http://wordpress.org/plugins/lazy-load/

  • The topic ‘Lazy Load and wpautop img wrap’ is closed to new replies.