wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
get_post_thumbnail_id › WordPress Function
Od2.9.0
Przestarzałyn/a
› get_post_thumbnail_id ( $post = null )
| Parametry: |
|
| Powrót: |
|
| Zdefiniowane na: |
|
| Codex: | |
| Dziennik zmian: |
|
Retrieves the post thumbnail ID.
Powiązane Funkcje: set_post_thumbnail, set_post_thumbnail_size, get_the_post_thumbnail, the_post_thumbnail, delete_post_thumbnail
Źródło
function get_post_thumbnail_id( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$thumbnail_id = (int) get_post_meta( $post->ID, '_thumbnail_id', true );
/**
* Filters the post thumbnail ID.
*
* @since 5.9.0
*
* @param int|false $thumbnail_id Post thumbnail ID or false if the post does not exist.
* @param int|WP_Post|null $post Post ID or WP_Post object. Default is global `$post`.
*/
return (int) apply_filters( 'post_thumbnail_id', $thumbnail_id, $post );
}