It is not possible to register field for settings route in REST API
-
I am trying to add option “show_on_front” into REST API. Following code works for other object types “post”|”page” etc. but not for “setting”. Is there something I am missing?
function add_field_show_on_front() { $args = [ 'get_callback' => function() { return get_option('show_on_front'); } ]; register_rest_field('setting', 'show_on_front', $args); } add_filter('rest_api_init', 'add_field_show_on_front');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘It is not possible to register field for settings route in REST API’ is closed to new replies.