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

WordPress Trac noreply at wordpress.org
Tue Jan 7 01:06:03 UTC 2020


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

 * owner:  (none) => SergeyBiryukov
 * status:  new => reviewing
 * milestone:  Awaiting Review => 5.4


Comment:

 When changing the return type, we have to be careful not to introduce back
 compat issue like in #22324.

 That said, I think it makes sense to clean this up while still early in
 the cycle. It would make the function more consistent with `get_the_ID()`
 or `wp_get_post_parent_id()`, both returning an integer.

 Note that some unit tests already cast the result to `(int)`:

 * [source:tags/5.3.2/tests/phpunit/includes/testcase-rest-post-type-
 controller.php?marks=81#L79]
 * [source:tags/5.3.2/tests/phpunit/tests/rest-api/rest-posts-
 controller.php?marks=2265,2277#L2260]

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


More information about the wp-trac mailing list