{"action":"created","issue":{"url":"https://api.github.com/repos/WP-API/WP-API/issues/2137","labels_url":"https://api.github.com/repos/WP-API/WP-API/issues/2137/labels{/name}","comments_url":"https://api.github.com/repos/WP-API/WP-API/issues/2137/comments","events_url":"https://api.github.com/repos/WP-API/WP-API/issues/2137/events","html_url":"https://github.com/WP-API/WP-API/issues/2137","id":129577056,"number":2137,"title":"Support - Get Multiple Custom Fields in one rest_api_init  request","user":{"login":"just10minutes","id":6675921,"avatar_url":"https://avatars.githubusercontent.com/u/6675921?v=3","gravatar_id":"","url":"https://api.github.com/users/just10minutes","html_url":"https://github.com/just10minutes","followers_url":"https://api.github.com/users/just10minutes/followers","following_url":"https://api.github.com/users/just10minutes/following{/other_user}","gists_url":"https://api.github.com/users/just10minutes/gists{/gist_id}","starred_url":"https://api.github.com/users/just10minutes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/just10minutes/subscriptions","organizations_url":"https://api.github.com/users/just10minutes/orgs","repos_url":"https://api.github.com/users/just10minutes/repos","events_url":"https://api.github.com/users/just10minutes/events{/privacy}","received_events_url":"https://api.github.com/users/just10minutes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-28T20:48:48Z","updated_at":"2016-01-29T06:49:49Z","closed_at":null,"body":"Hi ,\r\n\r\nI am going through this \r\nhttp://v2.wp-api.org/extending/modifying/\r\n\r\nIs it possible to register multiple fields in below code? The example specified uses only one custom field that is **starship**.  What if i have another custom field as **warship**, can i register in same **rest_api_init** request?\r\n```\r\n<?php\r\nadd_action( 'rest_api_init', 'slug_register_starship' );\r\nfunction slug_register_starship() {\r\n    register_rest_field( 'post',\r\n        'starship',\r\n        array(\r\n            'get_callback'    => 'slug_get_starship',\r\n            'update_callback' => null,\r\n            'schema'          => null,\r\n        )\r\n    );\r\n}\r\n\r\n/**\r\n * Get the value of the \"starship\" field\r\n *\r\n * @param array $object Details of current post.\r\n * @param string $field_name Name of field.\r\n * @param WP_REST_Request $request Current request\r\n *\r\n * @return mixed\r\n */\r\nfunction slug_get_starship( $object, $field_name, $request ) {\r\n    return get_post_meta( $object[ 'id' ], $field_name, true );\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/WP-API/WP-API/issues/comments/176604590","html_url":"https://github.com/WP-API/WP-API/issues/2137#issuecomment-176604590","issue_url":"https://api.github.com/repos/WP-API/WP-API/issues/2137","id":176604590,"user":{"login":"ekweible","id":684353,"avatar_url":"https://avatars.githubusercontent.com/u/684353?v=3","gravatar_id":"","url":"https://api.github.com/users/ekweible","html_url":"https://github.com/ekweible","followers_url":"https://api.github.com/users/ekweible/followers","following_url":"https://api.github.com/users/ekweible/following{/other_user}","gists_url":"https://api.github.com/users/ekweible/gists{/gist_id}","starred_url":"https://api.github.com/users/ekweible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekweible/subscriptions","organizations_url":"https://api.github.com/users/ekweible/orgs","repos_url":"https://api.github.com/users/ekweible/repos","events_url":"https://api.github.com/users/ekweible/events{/privacy}","received_events_url":"https://api.github.com/users/ekweible/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T06:49:49Z","updated_at":"2016-01-29T06:49:49Z","body":"I have this same question. I'm currently using this in combination with the Advanced Custom Fields plugin to add several custom fields to the response. I can retrieve all of the custom fields with a single call to ACF's `get_fields()`, so being able to add all of these fields in a single callback would be the most performant."}}