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

WordPress Trac noreply at wordpress.org
Fri Apr 7 09:52:18 UTC 2017


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

Comment (by flixos90):

 [attachment:wp-object-type.2.diff] is a possible implementation for what I
 described above, it is much more clear than the my first ad-hoc
 implementation. Again, please don't put too much value on the names at
 this point.

 The patch introduces:
 * `WP_Object_Type` class (represents a top-level object type, such as
 'post', 'term', 'comment', 'user')
 * abstract `WP_Object_Subtype` class that must be inherited by a more
 specific class that determines the "parent object type" (represents a
 subtype of a specific object type, such as 'post', 'page', 'category',
 'post_tag')
 * `WP_Type` interface used by `WP_Object_Type` and `WP_Object_Subtype`

 `register_meta()` could then accept either of the above classes (both of
 which implement the `WP_Type` interface). That makes it possible to
 register meta for an entire object type, but also for specific subtypes.

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


More information about the wp-trac mailing list