From 7e331ab23539a5ec73d3de393e60d4fd9775c1ab Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 2 Feb 2020 03:08:04 +0000 Subject: [PATCH] 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 --- wp-includes/post-thumbnail-template.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/post-thumbnail-template.php b/wp-includes/post-thumbnail-template.php index 8202f4eb6a..85fb0e31d9 100644 --- a/wp-includes/post-thumbnail-template.php +++ b/wp-includes/post-thumbnail-template.php @@ -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 ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index c770de9400..094d3b2912 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.