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.
Related Posts:
- How to Fix HTTP Error When Uploading Images?
- How to set featured image to custom post from outside programmatically
- media_sideload_image generates blank?
- How to crop thumbnail height to auto with set width
- How to use images uploaded with custom implementation of thickbox like the_post_thumbnail() functionality
- Upload image through URL?
- Is it possible to upload multiple images via Media Library tab in Thickbox I’ve created?
- How do I set a featured image (thumbnail) by image URL when using wp_insert_post()?
- How do I get image url only on the_post_thumbnail
- How to get image title/alt attribute?
- Add class name to post thumbnail
- No Thumbnails Generated
- How to disable WordPress from creating thumbnails?
- How to retrieve image from URL and set as featured image/post thumbnail
- How do you remove hard coded thumbnail image dimensions?
- How do you get the post thumbnail size?
- Setting a post’s featured image from an embedded YouTube video
- How to get featured image’s width and use elsewhere in template?
- set_post_thumbnail_size vs add_image_size
- Minimum Dimensions Requirement for Featured Image?
- Generate Thumbnails only for Featured Images
- How to get all featured image sizes and their URLs?
- How to disable generation of default image sizes for some custom post types?
- How to Dynamically Resize WordPress Image On-The-Fly (custom field/theme option)
- How to add post featured image to RSS item tag?
- How do I regenerate thumbnails?
- Display thumbnail only if requested size exists
- Upload post thumbnail from the front end
- Delete original image – keep thumbnail?
- Download an image from a webpage to the default uploads folder
- the_post_thumbnail responsive srcset not populating with custom image size
- Set custom name for generated thumbnails
- Post thumbnail alt title
- Get Featured Image via direct sql query
- Get featured image on Blog Index
- the_post_thumbnail hard cropping not working no matter what
- Can I refresh the thumbnails programmatically?
- How to add multiple image sizes of the same size with add_image_size
- New image size version only for the Featured Image file
- wp_get_attachment_image_src always returns full-sized image
- Media upload finished hook
- Get featured image URL by page id
- change set_post_thumbnail_size according to post type admin page
- Add Title Attribute to WordPress Image the_post_thumbnail
- Can’t extract and set SVG dimensions
- Set Featured Image Front Frontend Form
- Is there a hook which fires after all thumbnails are generated?
- Getting Thumbnail Path rather than Image Tag
- Display Category Thumbnail and links in Woo commerce
- What plugin can I use to create a list / slideshow of featured images?
- the_post_thumbnail with lazyload JQ plugin
- Replacing Gutenberg Featured Image control?
- Display Post Thumbnail Without Being Featured Image
- Featured Image of Video from oembed
- oEmbed, thumbnails and wordpress
- wp_get_attachment_image_src() and custom sizes
- Prevent WordPress from cropping GIF files
- Differentiate Featured Image from Post Images upon Upload
- Post thumbnail outside the loop
- What’s the difference between post thumbnails and featured images (if any)?
- Getting custom-sized featured image’s URL?
- Modify featured image path to Amazon S3
- What is your take: TimThumb vs. WordPress Thumbnails? The great debate [closed]
- Retrieve 1st image in post and set it as featured image, when post is saved/updated
- Use thumbnail image using url of that image
- Retrieve featured image as object
- How do I add the featured image to the_content after the first paragraph?
- Showing a placeholder/default img, if no featured image is set
- Re-order media links?
- Multiple featured image thumbnails for post types (Multiple Post Thumbnails plugin)
- admin-ajax.php returns 0. How do I debug it and fix it?
- the_post_thumbnail scaling not hard cropping
- Skip posts without a thumbnail in loop
- Thickbox hacking – removing fields
- wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); Getting thumb from wrong loop
- Set featured image for multiple posts
- adding an id to the_post_thumbnail
- Featured image size in ADMIN panel?
- Featured image with the same height thumbs returns wrong thumb
- How can I display my featured image correctly inside my single posts?
- How to change the naming of the resized image files
- Using media-upload.php to upload mp3 via custom fields
- Manipulating Media uploader
- Featured image upload finished hook
- How to get featured post title & image using JSON API?
- Generate thumbnail for images with the same size as thumbnails
- Set post thumbnail as background
- Display thumbnail only on the very first post in the loop?
- How to show featured image CAPTION only if it exist
- Set post-thumbnail (with php)?
- get_thumbnail_id returns full size image
- Implementing Zurb’s Interchange Into WordPress
- can the_excerpt function also get images?
- How to get_posts having post thumbnail?
- Convert uploaded PNG to JPEG automatically
- Add Image Dimensions to Media Library Tab on Media Upoader
- Change Output for Images in Content
- Featured Image Inherited from Parent Page
- Change wording of default thumbnail metabox
- Specific featured image for each category