Filter taxonomy terms in autocomplete list by boolean field on vocabulary's terms? I need to implement a boolean field for a vocabulary that determines whether terms within a vocabulary appear in autocomplete results for a taxonomy term reference field's autocomplete widget. The function taxonomy_autocomplete(...) has the query that I want to modify. But how can I modify the query or override the results of the autocomplete json callback?

I know how to add the boolean field to the vocabulary but not how to filter autocomplete results. The idea is to let users enter new terms but not have their new terms appear in autocomplete results unless approved by an admin.
Here is how I've added a new term custom widget: 

/**
 * Implements hook_field_widget_info().
 */
function deepestlevel_taxonomy_widget_field_widget_info() {

  return array(
    'textfield' =&gt; array(
      'label' =&gt; t('deepestlevel_taxonomy_widget - Only deepest level'),
      'field types' =&gt; array('taxonomy_term_reference'),
      'settings' =&gt; array(
        'size' =&gt; 60,
        'autocomplete_path' =&gt; 'deepestlevel_taxonomy_widget/autocomplete',
      ),
      'behaviors' =&gt; array(
        'multiple values' =&gt; FIELD_BEHAVIOR_CUSTOM,
      ),
    ),
  );
}

/**
 * Implements hook_field_widget_form().
 */
function deepestlevel_taxonomy_widget_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, $langcode, $items, $delta, $element) {

  $tags = array();
  foreach ($items as $item) {
    $tags[$item['tid']] = isset($item['taxonomy_term']) ? $item['taxonomy_term'] : taxonomy_term_load($item['tid']);
  }

  $element += array(
    '#type' =&gt; 'textfield',
    '#default_value' =&gt; taxonomy_implode_tags($tags),
    '#autocomplete_path' =&gt; 'deepestlevel_taxonomy_widget/autocomplete'. '/' . $field['field_name'],
    // '#autocomplete_path' =&gt; $instance['widget']['settings']['autocomplete_path'] . '/' . $field['field_name'],
    '#size' =&gt; $instance['widget']['settings']['size'],
    '#maxlength' =&gt; 1024,
    '#element_validate' =&gt; array('taxonomy_autocomplete_validate'),
  );

  return $element;
}

/**
 * Implements hook_menu().
 */
function deepestlevel_taxonomy_widget_menu() {
  $items['deepestlevel_taxonomy_widget/autocomplete'] = array(
    'title' =&gt; 'Autocomplete taxonomy deepest level',
    'page callback' =&gt; 'deepestlevel_taxonomy_widget',
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_CALLBACK,
  );
  return $items;
}

// THIS IS THE OVERRIDE CALLBACK copied from core taxonomy.pages.inc
// function taxonomy_autocomplete($field_name, $tags_typed = '') {
function deepestlevel_taxonomy_widget($field_name, $tags_typed = '') {

// NEW CODE HERE

}