i try use the media manager from wordpress i use the post editor outside admin wordpress and users can create a posts whit a featured image. I use _wp_post_thumbnail_html function to show image or show link to upload file, all users whit a rol "publisher" can upload images and upload work but doesn't work show featured image or assign to post.
on wp-ajax whit action: set-post-thumbnail returns 0 and image aren't assign to new post. wp-ajax.php:
json:true thumbnail_id:3952 _wpnonce:b02e8553f1 action:set-post-thumbnail
response: 0
My code as:
<?php $thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
//$postid = get_post( $post_id );
echo _wp_post_thumbnail_html( $thumbnail_id, $post_id );
?>
<br>
Very simple, show the media manager from wordpres, allow upload featured image but not allow assign to new post. Any solution?
edit: in edit post works fine allow change featured image i suppose because featured image required a post id, but on new post from wordpress allow upload image and asign this to new post.
This is proper image-uploading code.
And for Ajax code, go to this link. If you any problems, then please comment below.