我正在我的wordpress插件中构建一个文本编辑器功能。我需要一个建议,我的插件的功能是将wp-editor数据保存到一个包含html标签的php文件中。
如何获取包含html标签的wp-editor数据?
我的代码片段是
$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函数时,需要做什么修改吗?

谢谢
发布于 2018-10-17 14:58:56
看看这篇文章,我认为它会给你正确的方向--用htmlentities() + wpautop()的答案,同样的问题和相当好的解决方案-- https://wordpress.stackexchange.com/questions/290118/how-to-save-wp-editor-html-content-in-options-table
https://stackoverflow.com/questions/52848259
复制相似问题