Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mo3aser/874b0a5bf8bd17a75874 to your computer and use it in GitHub Desktop.
Save mo3aser/874b0a5bf8bd17a75874 to your computer and use it in GitHub Desktop.
Removing the automatic <p> and <br> WordPress Shortcodes.
<?php
// Removing the automatic <p> and <br> WordPress Shortcodes
// By Fouad Badawy | tielabs.com
function tie_fix_shortcodes($content){
$array = array (
'[raw]' => '',
'[/raw]' => '',
'<p>[raw]' => '',
'[/raw]</p>' => '',
'[/raw]<br />' => '',
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'tie_fix_shortcodes');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment