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) Post meta ID if the key didn't exist (ie. this is the first time that a thumbnail has been saved for the post), true on successful update, false on failure or if the value passed is the same as the one that is already in the database.
Defined at:

Description

Sets the post thumbnail (featured image) for the given post.

Related Functions

has_post_thumbnail, the_post_thumbnail, set_post_thumbnail_size, delete_post_thumbnail, get_post_thumbnail_id

Top Google Results

User discussions

wpseek mobile