Programmatically create user reference field I want to add a user reference field in taxonomy term. I create field and it's instance:

$field = ['field_name' =&gt; 'mymodule_employee',
        'label' =&gt; t('Employee'),
        'type' =&gt; 'entityreference',
        'cardinality' =&gt; 1,
        'settings' =&gt; [
            'target_type' =&gt; 'user',
            'handler' =&gt; 'base',
            'handler_settings' =&gt; [
                'target_bundles' =&gt; ['user']
            ],
        ],
];
field_create_field($field);

$instance = ['mymodule_employee' =&gt; [
            'entity_type' =&gt; 'taxonomy_term',
            'bundle' =&gt; 'my_vocabulary',
            'field_name' =&gt; 'mymodule_employee',
            'label' =&gt; t('Employee'),
            'widget' =&gt; array(
                'type' =&gt; 'options_select',
                'active' =&gt; 1,
            ),
            'settings' =&gt; array(
                'target_type' =&gt; 'user',
                'handler_settings' =&gt; array('target_bundles' =&gt; null),
                'handler' =&gt; 'base',
            ),
            'display' =&gt; array(
                'default' =&gt; array('label' =&gt; 'inline', 'type' =&gt; 'entityreference_label'),
            ),
            'required' =&gt; 0,
            'default_value' =&gt; null,
        ],
];
field_create_instance($instance);


Everything goes ok. But when I'm creating the term and try to choose a user there is an empty list. When I go to the field settings in admin form and just save it, everything begins to work.

What do I forget creating field and instance?
Check if Entity Reference Autocomplete  module helps you. The module page says


  This module defines a new form element type, called "entityreference",
  that allows developers to add autocomplete fields to forms, so that
  users can reference any entity in the same way they would do through
  an Entity Reference field.