[wp-trac] [WordPress Trac] #35658: Provide additional data for registered meta through register_meta()

WordPress Trac noreply at wordpress.org
Wed Jul 13 21:28:14 UTC 2016


#35658: Provide additional data for registered meta through register_meta()
-------------------------------------------------+-------------------------
 Reporter:  jeremyfelt                           |       Owner:  helen
     Type:  task (blessed)                       |      Status:  accepted
 Priority:  high                                 |   Milestone:  4.6
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-unit-tests needs-testing has-  |     Focuses:
  patch rest-api needs-dev-note                  |
-------------------------------------------------+-------------------------

Comment (by flixos90):

 Replying to [comment:115 jeremyfelt]:
 > This has become a lot more appealing to me in the last 24 hours. I've
 attached [attachment:35658.44.diff], which starts to make that conversion.
 The handling of `$object_type` into a base/sub type is a little rough, but
 all tests are passing.
 >
 > `register_meta( 'post:post', 'my_meta_key' );`

 I'm curious why we need to remove the `object_subtype` key from the array.
 Couldn't we support both ways of specifying the subtype? We could have the
 CURIE notation take precedence, but if someone doesn't specify it, but
 specifies the array key, we could still have it work.

 As we are in Beta, it's a common thing to change something like this, but
 I'm worried especially because this first way of doing it has already been
 made public in the dev note. I've personally updated one of my plugins to
 use that syntax, and although I could change it again of course, I'm
 pretty sure a few others have too. Therefore I think we should work in a
 backwards-compatible way here - I don't see why that would cause problems
 in this case.

 Actually, I think it might be useful to add wrapper functions for
 `register_meta()` for a specific object type. These functions could look
 like `register_post_meta( $post_type, $meta_key, $args )` or
 `register_term_meta( $taxonomy, $meta_key, $args )` and would align with
 other meta wrapper functions that developers regularly use - that's
 something else though, let's focus on what `register_meta()` will look
 like first.

 Sorry for all these points in one comment, but I wanted to get this off my
 chest, especially since I won't be able to attend tomorrow's meeting. :(

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


More information about the wp-trac mailing list