admin管理员组文章数量:1426123
I have built a plugin that will auto-generate an image based on some variables in the post the user is writing. They have the ability then to set some colors and stuff to make the image look nice. When the user is happy with this image they can click "save". This will call admin ajax and uses wp_insert_attachment
to create the image. This much is working.
As part of the ajax call I also call set_post_thumbnail( $postid, $image_id );
to set the featured image. The problem is that this does not update the UI of the post editor. The ajax call returns the attachment ID and image URL. I could manually mess with the dom to insert the image into the featured image box, but I want to know if there is anything in the WP javascript API that will allow me to update the UI of the post editor with this image.
本文标签: pluginsSet featured image using javascript in post editor
版权声明:本文标题:plugins - Set featured image using javascript in post editor 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745415118a2657647.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论