Skip to content

Commit a64ad57

Browse files
Docs: Update parameter type hints to include null for post thumbnail functions.
Follow-up to [12320], [12351], [20646], [32618], [34167], [34373], [37915]. Props apermo, jasonsa19. Fixes #62720. git-svn-id: https://develop.svn.wordpress.org/trunk@59548 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b8ecfbf commit a64ad57

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/wp-includes/post-thumbnail-template.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @since 2.9.0
2020
* @since 4.4.0 `$post` can be a post ID or WP_Post object.
2121
*
22-
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
22+
* @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global `$post`.
2323
* @return bool Whether the post has an image attached.
2424
*/
2525
function has_post_thumbnail( $post = null ) {
@@ -46,7 +46,7 @@ function has_post_thumbnail( $post = null ) {
4646
* @since 5.5.0 The return value for a non-existing post
4747
* was changed to false instead of an empty string.
4848
*
49-
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
49+
* @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global `$post`.
5050
* @return int|false Post thumbnail ID (which can be 0 if the thumbnail is not set),
5151
* or false if the post does not exist.
5252
*/
@@ -99,7 +99,7 @@ function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) {
9999
*
100100
* @global WP_Query $wp_query WordPress Query object.
101101
*
102-
* @param WP_Query $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
102+
* @param WP_Query|null $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
103103
*/
104104
function update_post_thumbnail_cache( $wp_query = null ) {
105105
if ( ! $wp_query ) {
@@ -156,10 +156,10 @@ function update_post_thumbnail_cache( $wp_query = null ) {
156156
* @since 2.9.0
157157
* @since 4.4.0 `$post` can be a post ID or WP_Post object.
158158
*
159-
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
160-
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of
161-
* width and height values in pixels (in that order). Default 'post-thumbnail'.
162-
* @param string|array $attr Optional. Query string or array of attributes. Default empty.
159+
* @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global `$post`.
160+
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of
161+
* width and height values in pixels (in that order). Default 'post-thumbnail'.
162+
* @param string|array $attr Optional. Query string or array of attributes. Default empty.
163163
* @return string The post thumbnail image tag.
164164
*/
165165
function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr = '' ) {
@@ -241,9 +241,9 @@ function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr =
241241
*
242242
* @since 4.4.0
243243
*
244-
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
245-
* @param string|int[] $size Optional. Registered image size to retrieve the source for or a flat array
246-
* of height and width dimensions. Default 'post-thumbnail'.
244+
* @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global `$post`.
245+
* @param string|int[] $size Optional. Registered image size to retrieve the source for or a flat array
246+
* of height and width dimensions. Default 'post-thumbnail'.
247247
* @return string|false Post thumbnail URL or false if no image is available. If `$size` does not match
248248
* any registered image size, the original image URL will be returned.
249249
*/
@@ -291,7 +291,7 @@ function the_post_thumbnail_url( $size = 'post-thumbnail' ) {
291291
*
292292
* @since 4.6.0
293293
*
294-
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
294+
* @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global `$post`.
295295
* @return string Post thumbnail caption.
296296
*/
297297
function get_the_post_thumbnail_caption( $post = null ) {
@@ -315,7 +315,7 @@ function get_the_post_thumbnail_caption( $post = null ) {
315315
*
316316
* @since 4.6.0
317317
*
318-
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
318+
* @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global `$post`.
319319
*/
320320
function the_post_thumbnail_caption( $post = null ) {
321321
/**

0 commit comments

Comments
 (0)