Revision: 66956
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 24, 2014 23:34 by razvanstavila
Initial Code
add_filter('the_content', 'remove_empty_tags_recursive', 20, 1);
function remove_empty_tags_recursive ($str, $repto = NULL) {
$str = force_balance_tags($str);
//** Return if string not given or empty.
if (!is_string ($str)
|| trim ($str) == '')
return $str;
//** Recursive empty HTML tags.
return preg_replace (
//** Pattern written by Junaid Atari.
'~\s?<p>(\s| )+</p>\s?~',
//** Replace with nothing if string empty.
!is_string ($repto) ? '' : $repto,
//** Source string
$str
);}
Initial URL
Initial Description
Remove Wordpress empty paragraphs form the_content() function.
Initial Title
Wordpress - Remove Empty paragraph tags with (nbsp)Â from the_content()
Initial Tags
wordpress
Initial Language
PHP