[wp-trac] [WordPress Trac] #36946: Provide `id` properties on core objects

WordPress Trac noreply at wordpress.org
Thu May 26 01:35:16 UTC 2016


#36946: Provide `id` properties on core objects
--------------------------+-----------------------------
 Reporter:  jeremyfelt    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------

Comment (by DrewAPicture):

 Replying to [comment:2 jeremyfelt]:
 > Replying to [comment:1 DrewAPicture]:
 > > My vote would be on standardizing on '''ID''' as it's actually the
 abbreviation for ''identifier'' and is what we (correctly) use all over
 the place in inline docs.
 > >
 > > 'id' makes me think of Freud. :-)
 >
 > Here's the [https://wordpress.slack.com/archives/core/p1464211408007002
 related discussion from today's core meeting]. Hopefully to sway you a
 bit. :)
 >
 > Also worth noting that the WP REST API team is using `id` in responses
 for core objects.

 Interesting. Of course it also doesn't help that we're sorely inconsistent
 at the db level either:

 * commentmeta: `meta_id`, `comment_id`
 * comments: `comment_ID`, `comment_post_ID`, `user_id`
 * options: `option_id`
 * postmeta: `meta_id`, `post_id`
 * posts: `ID`
 * termmeta: `meta_id`, `term_id`
 * terms: `term_id`
 * term_relationships: `object_id`, `term_taxonomy_id`
 * term_taxonomy: `term_taxonomy_id`, `term_id`
 * usermeta: `umeta_id`, `user_id`
 * users: `ID`

 Pretty much the only thing that's ''consistent'' there is that when it's
 'ID' alone, it's 'ID'. Yuck.

 All that aside, per the linked discussion, I ''really'' don't think a
 deprecated notice or a `_doing_it_wrong()` is a good idea, considering our
 history and the fact that `$user->ID` and `$post->ID` are used ''all
 over'' the WordPress ecosystem.

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


More information about the wp-trac mailing list