How can retrieve users custom fields only? I have created fields for users and also entry type.
I want to get only users fields. I have retrieved custom fields but that returns all the fields.

$users = \craft\elements\User::find()-&gt;id(USERID)-&gt;one();
print_r($users-&gt;getbehaviors()['customFields']);


I know how to get user custom fields with field Handle.
I need only users fields (whole users fields not single) that admin assign in the CP. ( settings/users/fields ).
You can do this by going via the element's field layout:

$user = \craft\elements\User::find()-&gt;id(1)-&gt;one();

$fields = $user-&gt;getFieldLayout()-&gt;getFields();


This will return you an array of all the fields (fields, not values) attached to your user.