Docs: Clarify the `@return` value for `wp_get_attachment_image_url()` and `get_the_post_thumbnail_url()`.

Props GeekPress, audrasjb, naveen17797.
Fixes #52183.
Built from https://develop.svn.wordpress.org/trunk@50236


git-svn-id: http://core.svn.wordpress.org/trunk@49897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-02-08 14:14:08 +00:00
parent d5fd2d8ea7
commit 8bc5c10684
3 changed files with 7 additions and 5 deletions

View File

@ -1124,7 +1124,8 @@ function wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = f
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of
* width and height values in pixels (in that order). Default 'thumbnail'. * width and height values in pixels (in that order). Default 'thumbnail'.
* @param bool $icon Optional. Whether the image should be treated as an icon. Default false. * @param bool $icon Optional. Whether the image should be treated as an icon. Default false.
* @return string|false Attachment URL or false if no image is available. * @return string|false Attachment URL or false if no image is available. If `$size` does not match
* any registered image size, the original image URL will be returned.
*/ */
function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) { function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
$image = wp_get_attachment_image_src( $attachment_id, $size, $icon ); $image = wp_get_attachment_image_src( $attachment_id, $size, $icon );

View File

@ -215,9 +215,10 @@ function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr =
* @since 4.4.0 * @since 4.4.0
* *
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
* @param string|int[] $size Optional. Registered image size to retrieve the source for or a flat * @param string|int[] $size Optional. Registered image size to retrieve the source for or a flat array
* array of height and width dimensions. Default 'post-thumbnail'. * of height and width dimensions. Default 'post-thumbnail'.
* @return string|false Post thumbnail URL or false if no URL is available. * @return string|false Post thumbnail URL or false if no image is available. If `$size` does not match
* any registered image size, the original image URL will be returned.
*/ */
function get_the_post_thumbnail_url( $post = null, $size = 'post-thumbnail' ) { function get_the_post_thumbnail_url( $post = null, $size = 'post-thumbnail' ) {
$post_thumbnail_id = get_post_thumbnail_id( $post ); $post_thumbnail_id = get_post_thumbnail_id( $post );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.7-beta1-50235'; $wp_version = '5.7-beta1-50236';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.