Extend WordPress users/me endpoint with user email

function email_add_user_data() {
register_rest_field( 'user',
    'user_email',
    array(
        'get_callback'  => 'rest_get_user_field_mail',
        'update_callback'   => null,
        'schema'            => null,
     )
);
}
add_action( 'rest_api_init', 'email_add_user_data' );

function rest_get_user_field_mail( $user, $field_name, $request ) {
    $current_user = wp_get_current_user();
    return $current_user->user_email;
}

In

Con Schneider