WordPress.org

Ready to get started?Download WordPress

Forums

Evil auto-closing P tag Wackiness (4 posts)

  1. Baden
    Member
    Posted 2 years ago #

    Clearly the fourms are filled with issues about wordpress adding p and br tags. But this one is different.

    I have build a short code plugin called collapse-o-matic. As of WordPress 3.3, upon the first use of the short code, WordPress will nearly ALWAYS insert a closing p tag. But here is the thing: the closing p tag does NOT show up when viewing source.

    Want to see an example? Here, check out this demo page:
    http://spacedonkey.de/
    See the space between the first expand element and the rest? Well if you inspect this element you will see that WordPress had decided to insert a closing p tag between the first span and div elements that the short code creates like so:
    <span class="collapseomatic" id="id3178" title="push my button baby">push my button baby</span></p><div id="target-id3178" class="collapseomatic_content " style="display: none; ">bamp chica baw-wa</div>

    However, if you view the page's source: view-source:http://spacedonkey.de/ look around lines 98 and 99... there is no closing p tag to be found.

    What in the world is'a goin' on a'round heyah?!

  2. Baden
    Member
    Posted 2 years ago #

    This is due to the wpautop function.
    After the last 2 hours, I have found many references to the fact that this is a known buggy function in WordPress, and is slated to be fix in some future release.

  3. acurran
    Member
    Posted 2 years ago #

  4. Baden
    Member
    Posted 2 years ago #

    Thanks acurran. We have also come up with a simular solution, however, is there an issue with effecting the formatting of other plugins? Here is a thread on the best-practices for dealing with shortcodes, content and wpautop. Hopefully there can be a unified approach to this, rather than every other plugin resetting the execution order of wpautop.

    It seems like this would be a bigger issue among plugin developers.

Topic Closed

This topic has been closed to new replies.

About this Topic