HOW TO REMOVE EMPTY PARAGRAPH TAGS FROM SHORTCODES IN WORDPRESS

Simply drop the following code in your theme’s functions.php file and Enjoy! No more annoying empty paragraphs tags in your content.

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(
        '

['    => '[',

        ']

'
   => ']',
        ']
'
=> ']'
    );
    return strtr$content$array ); 
}