admin管理员组文章数量:1434929
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))
本文标签: theme developmentWpautop in wpeditor not working
版权声明:本文标题:theme development - Wpautop in wp_editor not working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745624420a2666883.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论