Set Featured Image programmatically (in admin) with JavaScript?
You need to do an ajax call with action: ‘set-post-thumbnail’ Check in admin-ajax.php (line 1477 in 3.3.2) for the expected values and nonce, but in general you need to send post_id, attachment_id and nonce. The nonce should come from: wp_create_nonce( “set_post_thumbnail-$post_id” ); The admin does something like: uploader.bind(‘FileUploaded’, function(up, file, response) { jQuery.post(ajaxurl, { action:”set-post-thumbnail”, … Read more