Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wordpress: Shortcode Empty Paragraph fix
function shortcode_empty_paragraph_fix($content)
{
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'shortcode_empty_paragraph_fix');
@adamhopkinson

This comment has been minimized.

Copy link

adamhopkinson commented Oct 23, 2013

That's a great solution, thanks!

@hieronymusdesign

This comment has been minimized.

Copy link

hieronymusdesign commented Jan 9, 2014

After 6 hours and 7 beers i came across this code. You saved my night. Cheers mate.

@MatthewKosloski

This comment has been minimized.

Copy link

MatthewKosloski commented Jul 2, 2017

Holy shit this is a life saver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.