[wp-trac] [WordPress Trac] #52298: Using ID as type string instead of int

WordPress Trac noreply at wordpress.org
Thu Jan 14 16:01:45 UTC 2021


#52298: Using ID as type string instead of int
-------------------------------+------------------------------
 Reporter:  malthert           |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  General            |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:   => reporter-feedback


Comment:

 Hi there, welcome back to WordPress Trac! Thanks for the ticket.

 Replying to [ticket:52298 malthert]:
 > There is currently no way to retrieve a post ID as int in WP, which
 means we ALWAYS have to typecast it.

 Could you elaborate a bit more? Most of the functions like `get_the_ID()`
 or `get_post()` return the post ID as `int`, this is done via
 `sanitize_post()`. Changing the ID to a string instead would be a backward
 compatibility break.

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


More information about the wp-trac mailing list