Post Thumbnails: Make sure get_post_thumbnail_id() returns an integer, to match the documented return value.

This makes the function more consistent with `get_the_ID()` or `wp_get_post_parent_id()`, both returning an integer.

Props 0v3rth3d4wn.
Fixes #40096.
Built from https://develop.svn.wordpress.org/trunk@47160


git-svn-id: http://core.svn.wordpress.org/trunk@46960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-02 03:08:04 +00:00
parent c94722d9bc
commit 7e331ab235
2 changed files with 3 additions and 3 deletions

View File

@ -45,14 +45,14 @@ function has_post_thumbnail( $post = null ) {
* @since 4.4.0 `$post` can be a post ID or WP_Post object.
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
* @return string|int Post thumbnail ID or empty string.
* @return int|string Post thumbnail ID or empty string if the post does not exist.
*/
function get_post_thumbnail_id( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return '';
}
return get_post_meta( $post->ID, '_thumbnail_id', true );
return (int) get_post_meta( $post->ID, '_thumbnail_id', true );
}
/**

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47159';
$wp_version = '5.4-alpha-47160';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.