WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/set post thumbnail

Contents

Description

Sets a post thumbnail.

Usage

<?php set_post_thumbnail$post$thumbnail_id ); ?>

Parameters

$post
(int) (Post ID or object where thumbnail should be attached.) object
Default: required
$thumbnail_id
(integer) (required) Thumbnail to attach.
Default: None

Return Values

(boolean) 
True on success, false on failure.

Change Log

Source File

set_post_thumbnail() is located in wp-includes/post.php.

Related

delete_post_thumbnail()

See also index of Function Reference and index of Template Tags.