【发布时间】:2018-02-01 20:39:39
【问题描述】:
我目前正在构建一个插件,该插件需要我删除 TinyMCE 编辑器并替换为文本区域。
以下代码帮助我从管理区域中删除 TinyMCE 编辑器:
function wpdocs_remove_post_type_support() {
remove_post_type_support( 'post', 'editor' );
}
add_action('init' ,'wpdocs_remove_post_type_support' );
然后我用以下代码添加我自己的文本区域:
function myprefix_edit_form_advanced() {
require('texteditor.html');
}
add_action( 'edit_form_after_title', 'myprefix_edit_form_advanced' );
我的 texteditor.html 看起来像这样:
<html>
<head>
</head>
<body>
<div>
<textarea id="text" name="post_content" data-placeholder="start writing...">
</textarea>
</div>
</body>
</html>
完成上述所有代码后,我可以使用 textarea 保存内容,但是当我进入编辑帖子区域时,textarea 字段中没有显示任何帖子内容。我的问题是,我可以调用任何函数来确保帖子内容显示在 textarea 中。
非常感谢任何帮助。
谢谢。
【问题讨论】: