How To Disable WordPress wpautop for Shortcodes

Published Date Author: , Posted June 15th, 2018 at 1:35:54pm

remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'smart_autop' );
function smart_autop($content) {
$post = get_post();
if($post->post_type != 'post') return $content; // if not a post, leave $content untouched
return wpautop($content);
}

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.