Hey guys,
remove_filter seems to be bad practice as it might break other plugins from working. Do you know any other solution to remove p tags to appear before and after the content page?
Thanks!
- Has been a member for 4-5 years
- Item was Featured
- Author was Featured
- Bought between 100 and 499 items
- Referred between 200 and 499 users
- Exclusive Author
- Microlancer Beta Tester
- Author had a Free File of the Month
purethemes said
http://betterwp.net/17-protect-shortcodes-from-wpautop-and-the-likes/
Thanks purethemes, appreciated!
This is what I use:
function wpex_clean_shortcodes($content){
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'wpex_clean_shortcodes');
- Has been a member for 4-5 years
- Item was Featured
- Author was Featured
- Bought between 100 and 499 items
- Referred between 200 and 499 users
- Exclusive Author
- Microlancer Beta Tester
- Author had a Free File of the Month
@WPExplorer
really? on your themes here? I was rejected for this twice.
and what is your Idea about this
remove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop' , 99); add_filter( 'the_content', 'shortcode_unautop',100 );
WPExplorer said
This is what I use:function wpex_clean_shortcodes($content){ $array = array ( '<p>[' => '[', ']</p>' => ']', ']<br />' => ']' ); $content = strtr($content, $array); return $content; } add_filter('the_content', 'wpex_clean_shortcodes');
I have done the same thing at the end, thanks WPExplorer
PersianArt said
and what is your Idea about thisremove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop' , 99); add_filter( 'the_content', 'shortcode_unautop',100 );
It should not be an issue as you are putting it back but I still wouldn’t touch the wp core even though it’s cleaner… not sure it would be accepted. Post back to confirm if it is.
MonkeeThemes saidI don’t think the reviewers would allow that. Last time my theme was soft rejected because of that code.
PersianArt saidIt should not be an issue as you are putting it back but I still wouldn’t touch the wp core even though it’s cleaner… not sure it would be accepted. Post back to confirm if it is.
and what is your Idea about thisremove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop' , 99); add_filter( 'the_content', 'shortcode_unautop',100 );
purethemes said
@WPExplorer really? on your themes here? I was rejected for this twice.
Interesting to hear. Requested staff reply for this.
