[wp-trac] [WordPress Trac] #38490: Add settings to the `/wp/v2/settings` endpoint that are in the WordPress.com api
WordPress Trac
noreply at wordpress.org
Thu Nov 3 18:54:11 UTC 2016
#38490: Add settings to the `/wp/v2/settings` endpoint that are in the
WordPress.com api
-----------------------------------------+-----------------------
Reporter: joehoyle | Owner: joehoyle
Type: task (blessed) | Status: assigned
Priority: normal | Milestone: 4.7
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: has-patch reporter-feedback | Focuses:
-----------------------------------------+-----------------------
Comment (by joehoyle):
@jnylen0 to mark the settings as read-only you could hook into
`register_setting_args` and set the schema's `readonly` property to true.
This would be the same we we indicate all other read-only fields in the
API.
To better support `readonly` functionality in the settings endpoint, we
could allow:
{{{#!php
<?php
register_setting( 'some_group', 'my_read_only_test', array(
'show_in_rest' => array(
'type' => 'string',
'schema' => array(
'readonly' => true,
),
),
));
}}}
Right now, you can do that and read-only will show in the Schema, however
the settings controller won't respect it it's self.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38490#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list