even if you had included the all of the needed files you will still have to create your some extra hidden fields like _nonce to pass the
check_ajax_referer( "set_post_thumbnail-$post_ID" );
also you would need to create an action hidden field to identify the case of Ajax call with the value : "set-post-thumbnail"
You are better of creating your own Ajax call
and simply use in your callback function:
set_post_thumbnail( $post, $thumbnail_id );
//or
update_post_meta( $post->ID, '_thumbnail_id', $attachment_id );
and to unset use
delete_post_meta( $post_ID, '_thumbnail_id' );
Related Posts:
- Download an image from a webpage to the default uploads folder
- Is there a hook which fires after all thumbnails are generated?
- Frontend Post – Allow Only Image File Upload
- Can’t seem to attach uploaded image to post and set it as thumbnail
- How to stop thumbnail generation from some images and different size thumbnail generate
- How to replace images?
- How to set uploaded image as featured image wordpress
- adding image to post thumbnail from another server
- WordPress Multisite: Images moved to /sites/1?
- How to delete original image file after upload and resize
- An error has occurred during the upload process in wordpress version 5.3.2
- Troubles with code for upload a image
- Limit image resolution on upload
- Media Upload Folder – how to manage
- Change WordPress image URLs via filter
- get_the_post_thumbnail_url with an unregistered size
- Any easy way to automatically set the first inline image in a post as the thumbnail?
- Upload multiple images in a custom metabox
- hook into completed image upload filter
- Adding upload button in metabox
- Images uploading to wrong folder
- Convert uploaded PNG to JPEG automatically
- Programatically creating image attachments from local URLs and setting featured image
- How do i upload an image and return the image id?
- WordPress function: limit size, only jpg, jpeg, limit of uploaded files per account
- How to increase media image scale limit?
- Is it possible to prevent users from uploading small images?
- How to upload image without post ID using the new media uploader?
- How to output placeholder image if no featured image set?
- Uploading an image as featured image from frontend form
- Setup A Default Featured Image
- Find posts without featured image? [duplicate]
- How do I add a featured image to a single post page?
- Why images/photos after being uploaded to my wordpress site get slightly blurry?
- How to disable the suffix “-scaled” which is being added at the end of each uploaded image?
- Disable wordpress image sizes generation
- Is 700,00 jpgs too many for a WordPress site.?
- Featured Image .svg height and width 1px only
- Images not working using Featured post
- Add instructions to featured image
- How do I get more image editing options in the admin?
- add_image_size() to crop images into squares?
- HTTP Error when uploading files above 7mb unless using GD Image Editor
- Lazyload post thumbnails
- wordpress media library shows empty images
- Woocommerce featured image of page – not product
- Store Snapshot created via wordpress to use with lightbox
- image in my post disappeared after I upload website to remote server
- Get image URL after image created from canvas and sent to WP uploads with AJAX
- How to stop wordpress always displaying full-res images
- WordPress PNG compression issue
- How to implement secure frontend image upload? [closed]
- Is there any way to Integrate WordPress with Imgur for Image Hosting
- Change media URL (images)
- Custom Loop, Match Category with Page: How to display post featured image?
- Redirect to another page using contact form 7? [closed]
- How do I get my main image to stretch the full length of the screen?
- Images are not showing up in “Uploaded to this post”
- Autosort uploads in galleries by filename
- How to display original unmodified thumbnail
- How to set featured image from external url programmatically
- Images not found after migrating WordPress website
- Images uploading from media going in wrong folder
- Error uploading images in wordpress
- Set two default featured images
- Capitilize Alt/Title Tag in Image HTML, Reorder HTML Output
- How does wordpress name resized image copies?
- Set Featured Image not opening – Stuck at loading
- resize and crop thumbnail photos
- Metabox image upload value
- cant upload media/pictures to my wordpress site, cant upload anything to my database
- Save media files (images) to database instead of the filesystem
- Trouble with Uploading and Displaying Images
- How to use default image as featured image by implement some code in function.php
- Image alt attribute
- Images missing from Blog post page
- How to disable post-thumbnail from generation?
- second featured post not displaying on page [closed]
- Delete post if featured image is smaller than Y pixels by Y pixels
- How to get attachements URL from author meta and display them?
- What is the best way to handle Ajax image upload on front end?
- 403 Forbidden when accessing image in wordpress
- Url link to feature image in the portfolio [closed]
- get the post thumbnail returns the full size
- Missing Images in Uploads Directory (Server Only)
- How do I get resized thumbnails?
- Rename uploads filenames to POST-ID on upload
- Making a thumbnail if there exist a link with. jpg or .png extension in WordPress
- Why is WordPress loading a different sized post thumbnail?
- Transfered live site to new server and images are not showing
- Limit files uploaded per folder
- Images will not attach to posts after site migration
- Using the on-board image editor for featured images: edits are not being used
- Tried everything but Facebook share button won’t load the post thumbnail
- WP is showing wrong image dimensions
- Bug when uploading pictures with Arabic name characters?
- What type to upload image within theme options?
- Why some images are not allowed to be edited only for thumbnails?
- if user role is x – show image – wordpress
- Uploading media to wordpress API with C# HttpClient