set_post_thumbnail
set_post_thumbnail ( $post, $thumbnail_id )
Parameters:- (int|WP_Post) post Post ID or post object where thumbnail should be attached.
- (int) thumbnail_id Thumbnail to attach.
Returns:- (int|bool) True on success, false on failure.
Defined at: - Introduced in WordPress: 3.1.0
- Deprecated in WordPress: —
Description
Sets the post thumbnail (featured image) for the given post.