Support » Plugin: Shortcodes Ultimate » Empty paragraph tags in list shortcode

  • Resolved jrcollins


    Why am i getting empty <p></p> tags in my list shortcodes? I have removed all unnecessary white space and line breaks but the tags are still there between the outer <div> and <ul> tags.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I found the following function works for me:

    add_filter( 'the_content', 'tgm_io_shortcode_empty_paragraph_fix' );
     * Filters the content to remove any extra paragraph or break tags
     * caused by shortcodes.
     * @since 1.0.0
     * @param string $content  String of HTML content.
     * @return string $content Amended string of HTML content.
    function tgm_io_shortcode_empty_paragraph_fix( $content ) {
        $array = array(
            '<p>['    => '[',
            ']</p>'   => ']',
            ']<br />' => ']'
        return strtr( $content, $array );

    Place it in your child theme’s functions.php file.

    The above code was posted at the following URL:

    UPDATE: there’s another, easier, solution to this problem. At the top of the settings page for the plugin there’s a checkbox labelled, “custom formatting”. The description reads, “Enable this option if you face any problems with formatting of nested shortcodes.”

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Empty paragraph tags in list shortcode’ is closed to new replies.