[wp-trac] [WordPress Trac] #38323: Reconsider $object_subtype handling in `register_meta()`

WordPress Trac noreply at wordpress.org
Mon Nov 13 01:33:31 UTC 2017


#38323: Reconsider $object_subtype handling in `register_meta()`
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  5.0
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests 2nd-      |     Focuses:  rest-api
  opinion                                        |
-------------------------------------------------+-------------------------

Comment (by flixos90):

 One of the most important questions that we still need to answer is: How
 strict do we want to be about collisions? This was already discussed a
 short bit on the original ticket, particularly in
 https://core.trac.wordpress.org/ticket/35658#comment:127.

 Example: If someone does `register_meta( 'post, 'my_key', array() )` (i.e.
 for all post types) and someone else does `register_meta( 'post',
 'my_key', array( 'object_subtype' => 'my_post_type' ) )` (i.e. for the
 'my_post_type' post type only), should the second one be prevented if the
 meta key is already registered on the entire object type? Or vice-versa?
 Or should it always be "whoever comes first"? I assume most use-cases for
 using `register_meta()` would actually deal with certain post types, not
 entire object types (like all post types), so it may be something that
 rarely happens.

 Should we prevent one of the two above calls at all? Or should it be
 figured out whenever that key is used, by giving precedence to one or the
 other?

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


More information about the wp-trac mailing list