How to get the unverifiedEmail value of a user after a change email request? The currentUser.unverifiedEmail variable, which is public, is always empty on front end even after email change.

I thought it was a bug. I contacted Craft support about this, and here is Brad's answer:


  That's expected behavior... the default UserQuery (which is what {{
  currentUser }} is) only grabs a small subset of columns in it's select
  to avoid exposing potentially sensitive user account information
  throughout the system.
  https://github.com/craftcms/cms/blob/develop/src/elements/db/UserQuery.php#L310-L325
  
  If you want anything outside of that, you'll have to query for the
  data directly.


I tried this custom query:
{{ craft.users.id(currentUser.id).one().unverifiedEmail }}.
But even after requesting an email change, the value remain empty.

Any idea how to make this query from Twig?
You need to select the value

{% set user = craft.users
    .id(currentUser.id)
    .addSelect(['users.unverifiedEmail'])
    .one()
%}
{{ user.unverifiedEmail }}