/ Published in: PHP

Remove Wordpress empty paragraphs form the_content() function.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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. return $str; //** Recursive empty HTML tags. //** Pattern written by Junaid Atari. '~\s?<p>(\s| )+</p>\s?~', //** Replace with nothing if string empty. //** Source string $str );}
Comments
