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.js的wp.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不是唯一的.我能做些什么来完成这项工作?媒体管理器在内容页面上运行得非常好.