The set_post_thumbnail
function uses the metadata functions to set the featured image.
You have two actions to hook into that process:
EDIT: The action hooks are now defined different
Thanks @dalbaeb!
update_postmeta
, before the data is written into the database. Previouslyupdate_post_meta
updated_postmeta
, after the data is written into the database. Previouslyupdated_post_meta
SECOND EDIT: No need to panic
updated_{$meta_type}_meta
and update_{$meta_type}_meta
still work.
You will have to make a conditional, and be good to go:
if ( $metakey == '_thumbnail_id' ) { /*blabla*/ }
Related Posts:
- show hide image script after 4 seconds [closed]
- How to delete resized (cropped) image uploads and prevent future resizing?
- How to display a page’s featured image?
- Featured image shortcode
- Cropped featured image replaces original image in gallery
- How to create thumbnails with a fixed width, so all of them will have the same width?
- WordPress is Inserting images into Post as HTTP and not HTTPS
- Downsizing Many Large Images Attached to Posts, in Bulk?
- Adding custom image size to the media image editor
- Disabling auto-resizing of uploaded images
- How do I delete thousands of unattached images?
- Wrong domain in uploads folder
- How to remove link from an image in a post?
- How to set the width and height rule for featured image
- How to install Imagick or resolve issue
- Passing srcset to image attachment method
- Why is wordpress searching for @2x images?
- Responsive Images Resizing Images
- Broken urls with http site and https wp-admin
- Get uploaded image path in wordpress by filename
- Gallery post images on homepage?
- How to extract image width from add_image_size?
- Link to full size image or attachment page in photo theme
- How to get image ID to use inside wp_read_image_metadata()?
- Add “data-” attribute to image links
- How can I make all post image uploads have data-width and data-height attributes automatically by default?
- Large size image breaks template layout
- How to remove Geo Tagging on image uploads, but not other EXIF data?
- Replace original image, WP image editor
- WP Responsive images – upload custom image sizes
- Images not loading after migration
- Disable all resizing and compression
- Update old Post image metadata to ‘thumbnail’ wp_attached_file
- How to find images in lazyload to set alt attribute?
- Control Responsive Images
- How to throw admin notice error on image upload
- Get size of smaller image version
- How to add an image to the post preview in the free theme “food recipes”
- I am getting useless alphabets in images link
- wp_get_attachment_image_src() returning incorrect width and height [duplicate]
- Blank upload.php page
- The alt=”” attribute is empty
- Add custom text in the media library image meta area
- Unable to upload images to the Media Library. Getting this erron on the console wp-admin/async-upload.php 403 (Forbidden)
- how to move from content and place them elsewhere on a page template?
- Missing background image setting in admin of twenty nineteen
- Image editor is not loading
- Images give 404 after changing default domain
- Retrieve Image Attachments Getting Post Thumbnail Image First
- How can I check if the first block is an image aligned left or right?
- How would you add sequentially numbered labels to images in posts?
- Can wp_get_image_editor convert to icon?
- How to get image URL from media_sideload_image?
- Product Images Low Quality After Updating From WP 3.5 to 4 [closed]
- Auto-crop width, not height
- How can I change the to for lazyload wp smilies
- How to post images on my blog with a pre-defined border
- Output posts attached images as thumbnails linked to full-size with lightbox class
- Making a parent directory writable by the server
- my featured image of wordpress are not showing in the front end though image are uploaded in media library
- Images getting smashed
- Unset image sizes before images are uploaded
- Word press cutting sliding images – not displaying the entire image
- Wrap post images with a link, not figure (image_send_to_editor doesn’t work)
- An error has occurred during the upload process in wordpress 5.3.2
- get_the_post_thumbnail() title and alt attributes not displaying
- What is the best way to host a site with many images without it being too slow?
- Show featured image in all posts
- How to re-arrange images in default WP Gallery more than one image at once?
- After moving a site to new hosting, not all images are showing in media library
- Load only imagens resized in custom page
- How to inject alt and title attributes for every image in each post into HTML?
- Custom Background for each page and post
- How to see previous –next image option in the theme?
- Getting the Select and Crop Functionality Using Custom Fields
- Displaying “alt” attribute text as captions?
- Need help making my homepage blog image smaller than my post image
- After I upload a file to library its name converted to dashes
- Image to only show up in the single post page, not on the blog/home page
- Changing image size displayed in wordpress twenty fourteen theme
- How do I display image files as links?
- Broken Media Library
- wp_get_attachment_image_src() does not return what I want
- 3.5.x Theme Customize: Handling Custom Control Requests
- Wrap a post image with a div if it doesn’t have a caption
- Images in sub-pages fail to load
- How do add custom class and id to the that is generated from media gallery insert image into post [duplicate]
- Adding different classes to different images depending on size for fine control of image layout in posts
- How to display image ALT under image?
- Faster image upload on mobile [closed]
- Why are some SVG-images not visible in my footer?
- How To Get Feature Image from Blog in Same WordPress Multisite Blog on the Parent Blog?
- WPALLIMPORT Exporting images from repeater field [closed]
- What does WordPress media uploader do to image files on upload?
- Site header logo and parallax image on homepage do not display on iPhone
- WP_Image_Editor – How to save the new size of the image in the sizes metadata
- image_get_intermediate_size always returns false
- Change of displayed images for webp versions
- Is is possible to append .webp to srcset images using wp_filter_content_tags()?
- Could a very long article slow down all website and wpadmin?