plugins - Set featured image using javascript in post editor

I have built a plugin that will auto-generate an image based on some variables in the post the user is writing. They hav

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745415118a4626711.html

相关推荐

  • plugins - Set featured image using javascript in post editor

    I have built a plugin that will auto-generate an image based on some variables in the post the user is writing. They hav

    3小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信