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?


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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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