How to programmatically enable and set taxonomy access control for role
/**
 * Implements hook_node_access().
 */
function accommodation_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Session\AccountInterface $account) {
  if ($node-&gt;bundle() == 'accommodation' &amp;&amp; \Drupal::currentUser()-&gt;isAuthenticated())  {
    if ($node-&gt;get('field_accommodation_category')-&gt;entity-&gt;getName() == 'Category 1') {
      return \Drupal\Core\Access\AccessResult::allowed();
    }

    return \Drupal\Core\Access\AccessResult::forbidden();
  }

  return \Drupal\Core\Access\AccessResult::neutral();
}