Wordpress wp_editor不会添加图片

ric*_*uck 4 wordpress wordpress-plugin

我在循环中的插件中有以下代码,因此有多个WYSIWYG编辑器:

<?php wp_editor( stripslashes($arr['item-content']), $key.'-item-content', array(
    'editor_class' => 'tsort-contarea',
    'media_buttons' => true,
    'editor_height' => 360,

) ); ?>
Run Code Online (Sandbox Code Playgroud)

添加图像时,标记为send-attachment-to-editor内部的XHR请求wp-includes/js/media-editor.jswp.media.view.settings.post.id值为0.此外,wp.media.view.settings.nonce.sendToEditor始终为此值:e8b2eea867

return wp.media.post( 'send-attachment-to-editor', {
                nonce:      wp.media.view.settings.nonce.sendToEditor,
                attachment: options,
                html:       html,
                post_id:    wp.media.view.settings.post.id
            }); 
Run Code Online (Sandbox Code Playgroud)

xhr请求会发出罚款,但不会添加任何所见即所得.我确定这是因为post_id没有设置或因为nonce不是唯一的.我能做些什么来完成这项工作?媒体管理器在内容页面上运行得非常好.

源文件:http://pastebin.com/BhvqBLGB

Man*_*lis 7

来自法典:

请注意,传递给wp_editor()函数的ID只能由小写字母组成.没有下划线,没有连字符.其他任何东西都会导致WYSIWYG编辑器出现故障.(从3.6.1开始,您可以在ID中使用下划线.)

从我看到你正在使用破折号.尝试更改它,看看它是如何工作的.