post_thumbnail_id WordPress Filter Hook

The post_thumbnail_id hook is a great way to set a custom thumbnail for your posts. This hook allows you to set a custom post thumbnail for your post, which can be useful if you want to use a different image than the one that is set by default.

apply_filters( 'post_thumbnail_id', int|false $thumbnail_id, int|WP_Post|null $post ) #

Filters the post thumbnail ID.


Parameters

$thumbnail_id

(int|false)Post thumbnail ID or false if the post does not exist.

$post

(int|WP_Post|null)Post ID or WP_Post object. Default is global $post.


Top ↑

Source

File: wp-includes/post-thumbnail-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.