register_rest_field( 'post', 'metadata', array( 'get_callback' => function ( $data ) { return get_post_meta( $data['id'], '', '' ); }, ));