I recently added a custom meta box with Tinymce support. I wanted to output the data as html. If I code p tags manually inside Tinymce it works. But if I switch to Visual mode, the p tags aren't automatically added.
I used the wpautop argument inside wp_editor
but it didn't work. How may the paragraphs be automatically added?
I recently added a custom meta box with Tinymce support. I wanted to output the data as html. If I code p tags manually inside Tinymce it works. But if I switch to Visual mode, the p tags aren't automatically added.
I used the wpautop argument inside wp_editor
but it didn't work. How may the paragraphs be automatically added?
1 Answer
Reset to default 2Normally, the wpautop
filter is only applied to the_content
and the_excerpt
. In this case you want to apply it to metadata. So you'll have to add the filter.
If you look at get_post_meta
, you'll see that it is just a wrapper for get_metadata
. So it doesn't matter which one you use if you retrieve the content of the metabox. Unfortunately there is no filter call in there that you can use to modify what it returns.
So, that leaves you with the possibility to modify the metabox content after is has been retrieved. In stead of echo get_post_meta ($post_ID, $metabox_name)
you would write echo wpautop (get_post_meta ($post_ID, $metabox_name))
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745624420a4636718.html
评论列表(0条)