Skip to content

Instantly share code, notes, and snippets.

@maxxscho
Created March 17, 2012 12:48
Show Gist options
  • Save maxxscho/2058547 to your computer and use it in GitHub Desktop.
Save maxxscho/2058547 to your computer and use it in GitHub Desktop.
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');
@hieronymusdesign
Copy link

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

@MatthewKosloski
Copy link

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