[wp-trac] [WordPress Trac] #40096: get_post_thumbnail_id should return int

WordPress Trac noreply at wordpress.org
Sun Jul 5 10:15:56 UTC 2020


#40096: get_post_thumbnail_id should return int
-----------------------------+-----------------------------
 Reporter:  0v3rth3d4wn      |       Owner:  SergeyBiryukov
     Type:  enhancement      |      Status:  closed
 Priority:  normal           |   Milestone:  5.4
Component:  Post Thumbnails  |     Version:  2.9
 Severity:  normal           |  Resolution:  fixed
 Keywords:                   |     Focuses:  docs
-----------------------------+-----------------------------

Comment (by SergeyBiryukov):

 In [changeset:"48310" 48310]:
 {{{
 #!CommitTicketReference repository="" revision="48310"
 Post Thumbnails: Change the return value of `get_post_thumbnail_id()` for
 a non-existing post to `false` instead of an empty string.

 This further makes the function more consistent with `get_the_ID()` or
 `wp_get_post_parent_id()`, both returning `false` for a non-existing post.

 Additionally, document that `get_post_thumbnail_id()` returns `0` if the
 thumbnail image is not set.

 Follow-up to [47160].

 Props theMikeD, dingo_d, netpassprodsr, SergeyBiryukov.
 Fixes #49832. See #40096.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40096#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list