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');
One way to remove the shortcodes is by going through each post and page and editing them. Another way we can create shortcodes again and make sure it outputs nothing. This way you can just add a small function in your functions. php file and the shortcode will go away from all your post and pages.
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 );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With