remove empty <p> tags from wordpress shortcodes via a php functon
function, php, shortcode, wordpress
Solution
Try inserting this code in your `functions.php` file:
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop', 99 );
add_filter( 'the_content', 'shortcode_unautop', 100 );
Problem
Looking for a php function (non-jQuery or wpautop modification) approach to remove `<p></p>` from within wordpress. I tried this but it does not work: ``` function cleanup_shortcode_fix($content) { $array = array ( '<p>[' => '[', ']</p>' => ']', ']<br />' => ']', ']<br>' => ']' ); $content = strtr($content, $array); return $content; } add_filter('the_content', 'cleanup_shortcode_fix'); ```