- "access" is a custom field of the posts. Add this to the functions.php:
function get_post_meta_cb($object, $field_name, $request){
return get_post_meta($object['id'], $field_name, true);
}
function update_post_meta_cb($value, $object, $field_name){
return update_post_meta($object['id'], $field_name, $value);
}
add_action('rest_api_init', function(){
register_rest_field('post', 'access',
array(
'get_callback' => 'get_post_meta_cb',
'update_callback' => 'update_post_meta_cb',
'schema' => null
)
);
});