No, you can’t use set_post_thumbnail()
to remove the post thumbnail. The function you need is delete_post_thumbnail()
.
// Both of these work.
delete_post_thumbnail( $post->ID ); // pass the post ID
//delete_post_thumbnail( $post ); // or post object
Related Posts:
- Missing feature image link function
- functions.php inject inline css
- Automatically set the featured image
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Add options to featured image
- Linking thumbnail to full size image
- Generating Responsive Background Image Sizes in PHP
- Why are image thumbnails cropped proportionally (not per dimensions)?
- Add a Post Thumbnail to an RSS Feed with custom size
- Make WordPress size and name images for Retina.js
- Why are image thumbnails cropped proportionally (not per dimensions)?
- the_post_thumbnail fallback using hooks
- Display height and width properties with the_post_thumbnail() or related function
- Setting featured image with function, 1 part not working
- Removing the first image in content
- How to set the jpg image compression for specific thumbnail sizes?
- Function to auto-set a featured image that is already in use
- How to use max and min values of custom fields
- Get the 5 lastest Featured Posts from a category
- How to display a default image for post thumbnail using functions.php?
- Change size and crop medium_large images
- Getting Featured Image Caption to Only Show if Populated
- wp_get_attachment_image function size argument not working if I also add a custom class
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- Add Featured image column into wordpress admin on pages AND posts
- Post thumbnail not showing in WP admin area for custom post type
- Run function when WordPress new multisite is created or ACF field is updated
- Having issues with a foreach inside of a shortcode with ACF gallery
- Overwriting Parent Theme’s Image Sizes
- Backstretch.js and thumbnail sizes to reduce loading time
- set_post_thumbnail when user is not logged in
- How to stop twenty fifteen theme from cropping featured images?
- Get Current Post ID in functions php, meta query filter
- Can you put a condition on add_image_size() depending on the width of the uploaded image?
- show first 3 thumbnails of posts in different sizes [closed]
- Set spesific size of featured images
- Can’t generate thumbnail images
- Redirect to another page using contact form 7? [closed]
- ACF not showing
- It does not work concatenation in function.php
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- How to retrieve the current post’s generated featured image size?
- Check if the image size is available and if not use ‘full’ image size
- is there a way to remove featured image from blog page and single page
- How to hide image-url if no attachment?
- Add php code to wp_print_scripts?
- Access category within rss2_head hook?
- Programmatically add Yoast meta description after post save
- Compare meta key to current date in pre get post
- How to add a new image size and apply it to posts only?
- Using two loops in one WordPress template
- Show Featured Image in else statement
- Change custom featured image size in twentythirteen child theme
- resizing of thumbnails not working
- Perform function on publish AND save (not just save)
- Featured Image keeps cropping
- show all the posts thumbnails
- struggling with syntax for the_post_thumbnail();
- include w_thumbnail_src in function?
- Display ACF category image on archive and single template files
- Featured Image and Tags problem
- Custom image sizes showing in Classic Editor only when upladed directly to post
- Override a Post’s URL with Advanced Custom Fields Function
- WordPress Function Assistance with Loop
- How to show ACF value under post/page title in wp-admin
- How to display an image before title text in menu items
- Which filter fires upon setting a featured image
- Filter works on last selection but no others
- How to update an image attachment’s alt text from a custom field when saving a post?
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- remove_filter function to unhook twentysixteen parent theme function
- Help with with my function for wordpress
- Can You Set A Minimum Image Dimension For Resizing Images?
- ACF Date Form in Custom Admin Field
- Assign IDs to headings in ACF using functions.php
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- get_field() with ID in one signal filter not working
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- Featured image on archive page based on post type
- ACF Filter return value
- Printing medium sized image
- Sticky – Featured Image
- Frontend Feature image upload not work
- Return ACF Field value function
- Best way to add image to recent posts widget?
- Slider Thumbnail Size Issue [closed]
- Providing fallback function and allow override by plugin
- Remove Featured Images from Posts Older Than a Certain Date
- Different body image backgrounds on different pages, posts and categories
- update_post_meta not working in function
- Apply height and width for the_content() inside youtube video tag
- Set thumbnail from URL, by grabbing image in functions.php
- add_theme_support not outputting thumbnails
- Full size image option removing problem
- does acf_save_post cause endless loop?
- Call ACF data from functions.php [closed]
- Image width issue in IE [closed]
- Is mytheme_post_thumbnails() still necessary?
- Update post meta with wp cron