WordPress.org

Support

Support » How-To and Troubleshooting » Shortcodes are wrapped in paragraph tags

Shortcodes are wrapped in paragraph tags

  • 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.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcodes are wrapped in paragraph tags’ is closed to new replies.