I got below error on my site recently.

Notice: Undefined index: parent in taxonomy_form_term_submit() (line 829 of /var/www/Sites/xxxxx/modules/taxonomy/taxonomy.admin.inc).

I google it and find there is an old issue but seems nothing solved.

In the issue, @Cracu did mention some part of core code may cause this error:

  if (!variable_get('taxonomy_override_selector', FALSE)) {
    $parent = array_keys(taxonomy_get_parents($term->tid));
    $children = taxonomy_get_tree($vocabulary->vid, $term->tid);

    // A term can't be the child of itself, nor of its children.
    foreach ($children as $child) {
      $exclude[] = $child->tid;
    $exclude[] = $term->tid;

    $tree = taxonomy_get_tree($vocabulary->vid);
    $options = array('<' . t('root') . '>');
    if (empty($parent)) {
      $parent = array(0);
    foreach ($tree as $item) {
      if (!in_array($item->tid, $exclude)) {
        $options[$item->tid] = str_repeat('-', $item->depth) . $item->name;
    $form['relations']['parent'] = array(
      '#type' => 'select',
      '#title' => t('Parent terms'),
      '#options' => $options,
      '#default_value' => $parent,
      '#multiple' => TRUE,


I try to look into the latest core, this part of code is still there with same logics. Unfortunately, I need taxonomy_override_selector be TRUE.

Apart from setting taxonomy_override_selector to FALSE or adding new form validation handler to set $form_state['values']['parent'].

Do anyone know if there is solution for that?

  • You must of done something to cause it. What have you done recently? installed any custom module? contrib module? Do you have a backup(s) to check if the error is there or not?
    – No Sssweat
    Commented Aug 6, 2016 at 7:07
  • I am working in a large project and there are so many changes / commits every day. It is very hard to say what have been changed. LOL
    – Jimmy Ko
    Commented Aug 6, 2016 at 16:26

1 Answer 1


There's a couple of ways you could go about the problem:

  1. Patch Core: If there's no outstanding issue for the problem, alter core, create a patch & bug report, and submit your patch. You can manage your patch in your deployment process until the patch is accepted upstream.
  2. Custom Module: Looking at the comment above the code you posted, it was authored with the intention that someone might need to alter the form ("Contrib modules can then intercept before hook_form_alter to provide scalable alternatives."). You can use a HOOK_form_taxonomy_form_term_alter invocation to alter the submission handler or the form array to mitigate the warning introduced.

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.