[wp-trac] [WordPress Trac] #49255: It is not possible to register field for settings endpoint.
WordPress Trac
noreply at wordpress.org
Tue Jan 21 15:34:09 UTC 2020
#49255: It is not possible to register field for settings endpoint.
--------------------------+-----------------------
Reporter: vavra7 | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: REST API | Version: 4.7
Severity: normal | Resolution: invalid
Keywords: needs-patch | Focuses: rest-api
--------------------------+-----------------------
Changes (by TimothyBlynJacobs):
* status: new => closed
* version: 5.3.2 => 4.7
* resolution: => invalid
* milestone: Awaiting Review =>
Comment:
Hi @vavra7,
Thanks for the ticket! This is intended behavior, if you want to add a
setting to the settings controller, you should register the option using
`register_setting` and setting `show_in_rest` to `true`.
For instance:
{{{#!php
<?php
register_setting(
'writing',
'default_category',
array(
'show_in_rest' => true,
'type' => 'integer',
'description' => __( 'Default post category.' ),
)
);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49255#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list