Skip to content

Instantly share code, notes, and snippets.

@gnikolopoulos
Created January 19, 2016 18:45
Show Gist options
  • Save gnikolopoulos/0bfea14434c08c1064e2 to your computer and use it in GitHub Desktop.
Save gnikolopoulos/0bfea14434c08c1064e2 to your computer and use it in GitHub Desktop.
[Wordpress] Remove p and br tags from custom shortcodes
<?php
if( !function_exists('id_fix_shortcodes') ) {
function id_fix_shortcodes($content){
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'id_fix_shortcodes');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment