gpt4 book ai didi

WordPress wp_editor 不会添加图像

转载 作者:行者123 更新时间:2023-12-03 00:01:02 26 4
gpt4 key购买 nike

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

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

) ); ?>

添加图像时,wp-includes/js/media-editor.js 内标记为 send-attachment-to-editor 的 XHR 请求有一个 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
});

xhr 请求正常触发,但不会添加任何所见即所得。我确信这是因为 post_id 未设置或者随机数不唯一。我该怎么做才能使这项工作成功?媒体管理器在内容页面上运行得非常好。

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

最佳答案

来自Codex :

Note that the ID that is passed to the wp_editor() function can only be composed of lower-case letters. No underscores, no hyphens. Anything else will cause the WYSIWYG editor to malfunction. (As of 3.6.1 you can use underscores in the ID.)

据我所知,您当前正在使用破折号。尝试改变它,看看它是如何工作的。

关于WordPress wp_editor 不会添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28484058/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com