How to add taxonomy term reference field in a custom form In the previous version of Drupal, it was possible to reference taxonomy tags in Drupal's forms using the following option:

'#autocomplete_path' =&gt; 'taxonomy/autocomplete/'.$vid,


However, in the Drupal 8, taxonomy term reference field has been removed in favor of Entity reference, more info here.

So, is there any alternative available?
Well, I have found the way in the change records. take a look at: https://www.drupal.org/node/2418529

Here is the example options for taxonomy fields:

'#type' =&gt; 'entity_autocomplete',
'#target_type' =&gt; 'taxonomy_term',
'#selection_settings' =&gt; [
  'target_bundles' =&gt; array($vid1, $vid2),
],