[wp-trac] [WordPress Trac] #52298: Using ID as type string instead of int
WordPress Trac
noreply at wordpress.org
Thu Jan 14 14:15:41 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 | Keywords:
Focuses: |
--------------------------+-----------------------------
Currently all params/return treat IDs (e.g. post id) as type int.
However, this causes loads of typecasts, since by default all WP functions
retrieve things as strings. (get option, wpdb, get transient, cache get,
...), which means we always need to typecast when retrieving ids. There is
currently no way to retrieve a post ID as int in WP, which means we ALWAYS
have to typecast it.
Secondly, we dont do any numeric operations using IDs anyway (thus there
is no advantage of it being an int)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52298>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list