首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将wp编辑器的文本区数据保存到包含html标签的php文件中?

如何将wp编辑器的文本区数据保存到包含html标签的php文件中?
EN

Stack Overflow用户
提问于 2018-10-17 14:09:09
回答 1查看 1.3K关注 0票数 0

我正在我的wordpress插件中构建一个文本编辑器功能。我需要一个建议,我的插件的功能是将wp-editor数据保存到一个包含html标签的php文件中。

如何获取包含html标签的wp-editor数据?

我的代码片段是

代码语言:javascript
复制
$content=" ";
$editor_id="templateEditor";
$settings  = array (
        'wpautop'          => true,  
        'media_buttons'    => true,  
        'textarea_name'    => $editor_id,   
        'textarea_rows'    => get_option( 'default_post_edit_rows', 23),  
        'tabindex'         => '',     
        'editor_css'       => '',     
        'editor_class'     => '',     
        'teeny'            => false,  
        'dfw'              => false, 
        'tinymce'          => true,  
        'quicktags'        => true,   
        'drag_drop_upload' => true    
);
<?php wp_editor( $content, $editor_id,$settings); ?> 

上面的代码我用来在我的插件中显示wp-editor

在编辑器中,我可以看到文本和可视部分,它用html标签显示我的内容。提交表单后,我得到的是纯文本。我没有得到我可以在文本编辑器中看到的html标签。

谁能帮帮我吗?以便在提交wp-editor数据的同时也获得html标签。

当我收到data /wp_editor函数时,需要做什么修改吗?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2018-10-17 14:58:56

看看这篇文章,我认为它会给你正确的方向--用htmlentities() + wpautop()的答案,同样的问题和相当好的解决方案-- https://wordpress.stackexchange.com/questions/290118/how-to-save-wp-editor-html-content-in-options-table

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52848259

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档