I believe you need to use set_post_thumbnail to actually set featured image:
set_post_thumbnail($_POST['post_id'], $attachment_id);
Related Posts:
- How to get image title/alt attribute?
- How to Fix HTTP Error When Uploading Images?
- Delete original image – keep thumbnail?
- Set Featured Image Front Frontend Form
- media_sideload_image generates blank?
- How to change _wp_attachment_metadata specific value in SQL?
- Set (featured) thumbnail for post?
- How can I get a different image size, if all I have is the link?
- Delete all thumbnails for a post
- How to set an attachments parent post id in code?
- How do i show wordpress attachments from current post?
- Need clear explanation about medias/files/attchments
- Image still attached to post even after removing it as featured image
- Exclude featured image from attachment loop
- How to create resized versions of images added with wp_insert_attachment
- Show Multiple Size URL of one Featured Image/Thumbnail?
- Check if parent post is sticky on attachment page?
- How to attach images that I “insert from url” into the post?
- Moved server, and WP now uses original images for all thumb sizes?
- Featured Image URL is Showing but not thumbnail
- Import Dummy Content and Post Thumbnails
- Get all images from posts with maximum number and without featured image
- Why not attaching images after impoting using wp cli
- Close featured image modal windows with JS
- Add class name to post thumbnail
- the_post_thumbnail responsive srcset not populating with custom image size
- Set custom name for generated thumbnails
- How to add multiple image sizes of the same size with add_image_size
- change set_post_thumbnail_size according to post type admin page
- Getting Thumbnail Path rather than Image Tag
- How to crop thumbnail height to auto with set width
- Insert an image into a post by API
- adding an id to the_post_thumbnail
- How can I display my featured image correctly inside my single posts?
- Featured image upload finished hook
- Generate thumbnail for images with the same size as thumbnails
- Implementing Zurb’s Interchange Into WordPress
- Display the first image from a post in RSS feed
- Filter For Featured Image
- add_image_size and add_filter(‘image_size_names_choose’, ‘my_custom_image_sizes’) not working with wordpress 3.5.2
- why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?
- How to display thumbnail + tags + title of a child page?
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Archive Thumbnail Gallery
- WordPress Uploader Editor shows broken image
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- Can’t get image size set with set_post_thumbnail_size() function
- How to access featured image?
- Show LightBox when clicking on featured image [closed]
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- Get ID of featured image using “get_post_thumbnail_id(the_ID())” – without printing to screen?
- what is the difference between timthumb and post thumbnail?
- Duplicated featured image is not showing
- Set size for attachments
- Create thumbnail size only for a few images?
- Else condition not working while using has_post_thumbnail
- Only Display Thumbnail if Larger Than
- WP Query to set post thumbnail for existing old posts
- Why is the post title and content automatically being displayed in the post thumbnail (Featured image)?
- Disable post thumbnails in Twenty Thirteen child theme
- How can I find the first post in a category that has a featured image and then return the get_the_post_thumbnail()?
- Post thumbnail throwing size limit parameters in
- How do I add a default thumbnail to elseif when no get_field(‘photos’), and no post thumbnail exists?
- Problem with showing featured image
- Easy way to update a single translation entry without having to translate
- If the_post_thumbnail(); is this – echo this text
- Featured image not working
- Insert post’s category name into thumbnail string
- Thumbnails in ACF Query Results
- Icon over thumbnail according to post format
- Tweak next_post_link for it to include thumbnail
- The location of the html output from the_post_thumbnail();
- the_post_thumbnail() doesn’t always return selected size
- Get last post in category thumbnail
- WordPress not creating “large” thumbnails
- Custom caption output for custom image size
- how to create extra post thumbnail with merge of an icon image?
- Getting featured image setting as background
- WordPress 3.3.1 not cropping featured image
- Upload image through URL?
- How to add a default predefined thumbnail when creating a brand new post?
- the_post_thumbnail doesn’t resize properly
- Get featured image and additional posts thumbnail WordPress REST API
- Set featured image from auto generated video thumbnail url php
- Use Post Title as alt text for Featured Image
- WordPress default srcset with hard crop
- wp_get_attachment_metadata()[‘image_meta’] fetch WP metadata or EXIF?
- White Blank screen and issue to get thumbnail in
- Using lower resolution/size images for thumbnails on posts index
- How to have featured image show in standard RSS Widget
- Link from Thumbnail to Post not working
- Featured Image metabox (postimagediv) doesn’t appears when it should
- Thumbnails not showing in blog
- Featured Image inserted through custom query, does not show up
- How to import linked images and make them featured -> automagically
- Thumbnail images
- Featured Image Thumbnail Sizing
- How to modify Media Library images DPI [ image quality down to make small in size ] [closed]
- How to add text & call to action button to featured image on homepage?
- Featured image as background in a div using headway