I have a filter that removes opening p tags and replaces closing p tags with a br tag sitewide. The client would like this filter in a shortcode that they can use only on specific portions of the site. Could the following code be adapted for use inside of a shortcode?
add_filter( 'the_content', 'remove_p' );
function remove_p( $content ) {
$paragraphs = array("<p>","</p>");
$noparagraphs = array("","<br>");
return str_replace( $paragraphs, $noparagraphs, $content );
}
We've tried an assortment of plugins that toggle wpautop but were not happy with the results. Thanks in advance for any assistance.