WordPress.org

Ready to get started?Download WordPress

Forums

Shortcodes are wrapped in paragraph tags (4 posts)

  1. sheeptastic
    Member
    Posted 4 years ago #

    The HTML editor wraps shortcodes in paragraph tags. Apologies if this is a duplicate, I couldn't find any similar cases.

    I'm trying to add shortcodes for some HTML5 tags I want to use. Before I hit Publish/Update, it looks like this:

    [aside]
    <p>Aside content</p>
    [/aside]
    <p>More content outside of the aside</p>

    After, WordPress stuffs in <p> tags:

    <p>[aside]</p>
    <p>Aside content</p>
    <p>[/aside]</p>
    <p>More content outside of the aside</p>

    And sure enough, it doesn't come out of the_content() correctly. This is the output grabbed with wget:

    <aside></p>
    <p>Aside content</p>
    <p></aside>
    <p>More content outside of the aside</p>

    This is the page grabbed with Firefox. It moves the closing aside tag to the end:

    <aside>
    <p>Aside content</p>
    <p>
    </p><p>More content outside of the aside</p>
    </aside>

    I am at my wit's end; calling remove_filter('the_content', 'wpautop') in functions.php did nothing whatsoever. I noticed the filter shortcode_unautop but it does not seem to work as advertised.

    Note that it is the HTML editor that adds the offending <p>s.

    Thanks for any support.

  2. relish1227
    Member
    Posted 3 years ago #

    Did you ever find a solution to this?

  3. alexbalint
    Member
    Posted 3 years ago #

    We've used PHP Tidy extension to cleanup generated HTML, solved our problems for now.

  4. Covi
    Member
    Posted 3 years ago #

    Autop sucks :(

Topic Closed

This topic has been closed to new replies.

About this Topic