-
-
Save yumyo/4089059 to your computer and use it in GitHub Desktop.
Remove empty p tags from WordPress posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('the_content', 'remove_empty_p', 20, 1); | |
function remove_empty_p($content){ | |
$content = force_balance_tags($content); | |
return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
need to test if
add_filter('the_content', 'remove_empty_p',99999);
works better