I have a view that shows guest user generated articles grouped by taxonomy terms. There is just one taxonomy term which I don't want that users add articles with (only logged in users should). So how can I exclude this taxonomy term from the select list on the node add page? I suppose by some function in the theme file?

1 Answer 1


You need to implement hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) inside a custom module.


Inside the form parameter you should be able to unset the specific option that you don't want to be displayed.

  • I'm already using form alters in my theme file. Does it really have to be in a custom module?
    – 0711master
    Commented Mar 31, 2017 at 18:07
  • In drupal 8 you can write hooks inside the theme file.
    – Eyal
    Commented Mar 31, 2017 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.