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

WordPress Trac noreply at wordpress.org
Sat Jul 16 21:31:30 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 jeremyfelt):

 [attachment:35658.48.diff] registers meta based on the object type and
 does not do anything to guarantee uniqueness across object subtypes.

 * Removes `wp_object_type_exists()` so that `register_meta()` works
 alongside the other pieces of the meta API.
 * Removes `$object_subtype` throughout.
 * Alters the return type of `register_meta()` to boolean. Successful
 registration will return `true`. Old style arguments will result in
 `false`.
 * Removes the `sanitize_{$object_type}_{$object_subtype}_meta_{$meta_key}`
 and `auth_{$object_type}_{$object_subtype}_meta_{$meta_key}` filters.
 Without subtype, these are unnecessary.
 * Alters the return type of `unregister_meta_key()` to boolean.
 * Removes `WP_Error` as a possible return type for
 `get_registered_metadata()`.
 * Adjusts tests accordingly.

 Not tracking subtype in an initial iteration simplifies things
 significantly. This also leaves us open for other future approaches—colon
 delimited strings, some sort of `WP_Object_Type`, a more thorough
 approach, etc...

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


More information about the wp-trac mailing list