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

WordPress Trac noreply at wordpress.org
Fri Feb 10 05:06:11 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 westonruter):

 Just wanted to note that the Customize Posts plugin also wrestled with the
 problem of registering meta specifically to a dedicated post type. We came
 up with a `register_post_type_meta` method which takes three arguments:
 `$post_type`, `$meta_key`, `$setting_args`. The setting args includes the
 sanitize callback, default value, required capability, single vs multi,
 and other customizer-specific properties. Here is the method definition:
 https://github.com/xwp/wp-customize-
 posts/blob/f7b62df6744eb3eb54eb1aec9d877d51ee94cfff/php/class-wp-
 customize-posts.php#L230-L274

 Hopefully this provides helpful real world usage patterns for an enhanced
 `register_meta()`, specifically here with the needs of the customizer in
 view.

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


More information about the wp-trac mailing list