Image uploader with “Set Featured Image” link on front end

To get the "Use as featured Image" link you have to pass post_id to the media-upload.php file with the url so the request will be changed to:

var post_id = 234 // retrive the post id via php
var request = url.media_upload+'?post_id='+post_id+'type=image&TB_iframe=true';

Make sure you add the post_id very first of the url. It didn’t worked for me when i added the post_id to the last of the url.

UPDATE: Some javascript handling will be needed for the ajax response. Still working on to figure out that part. I will update my answer if i can figure it out.

Leave a Comment