Meta Box WYSIWYG, Shortcodes and wpautop
-
First off I want to say I have been using your method of meta boxes before you make it a plugin, which is awesome. ??
I created a WYSIWYG meta box. And at first it didn’t output shortcodes, which is important. So I added the following:
$content_middle = apply_filters('the_content', get_post_meta( get_the_ID(), 'content_middle', true)); echo $content_middle;
Now this works perfectly, however the wpautop makes it go crazy adding paragraph and break tags around the shortcodes. And that isn’t desired. It doesn’t do that in the_content area.
So, how do I use the WYSIWYG with shortcodes and stop it from adding breaks.
I’ve tried removing the filter with the following:
remove_filter( 'the_content', 'wpautop' );
Before it echos meta, and then adding the filter back:
add_filter( 'the_content', 'wpautop' , 12);
After it, and I’ve had no luck.
Yes I know that if I add it all in one continual line with no breaks it works, but this isn’t best methods for clients who need to edit their pages.
Any ideas would be appreciated. Thanks in advance!
- The topic ‘Meta Box WYSIWYG, Shortcodes and wpautop’ is closed to new replies.