[wp-trac] [WordPress Trac] #47023: Allow settings option schema to be modified

WordPress Trac noreply at wordpress.org
Wed Jun 12 05:21:26 UTC 2019


#47023: Allow settings option schema to be modified
-------------------------+----------------------
 Reporter:  pcfreak30    |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  REST API     |     Version:  4.7
 Severity:  normal       |  Resolution:  invalid
 Keywords:               |     Focuses:
-------------------------+----------------------
Changes (by TimothyBlynJacobs):

 * status:  new => closed
 * version:  5.2 => 4.7
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Hi @pcfreak30!

 Setting a custom schema is supported under the `show_in_rest` argument.

 {{{#!php
 register_setting('name', 'group', [
     'show_in_rest' => [
         'schema' => [
             'type'       => 'object',
             'properties' => [
                 'propA' => [
                     'type' => 'string',
                 ]
             ]
         ]
     ]
 ]);
 }}}

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


More information about the wp-trac mailing list