How to alter the $item value in taxonomy_field_is_empty without altering core taxonomy module? How to alter the $items value found in hook_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, $langcode, $items, $delta, $element) and pass it to hook_field_is_empty($item,$field)?


In a custom module,

function hook_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, $langcode, $items, $delta, $element){
$item = $items[$delta];
}


In taxonomy.module,

/**
 * Implements hook_field_is_empty().
 */
function taxonomy_field_is_empty($item, $field) {
  print_r($item);print_r($field);die('edd');
  if (!is_array($item) || empty($item['tid']) &amp;&amp; (string) $item['tid'] !== '0') {
    return TRUE;
  }
  return FALSE;
}


The  $item array structure in hook_field_is_empty($item,$field) is $item[0]['tid'] 
whereas taxonomy_field_is_empty($item,$field) expects to have structure as $item['tid'] .



Since its $item[0]['tid'], it gives undefined 'tid' which leads to returned value to be TRUE and hence field is said to be empty ,which is not the case usually.
I tried adding a custom hook in my module for hook_field_is_empty but it did not execute the hook at all ,even I tried adding -1 weight so it executes before taxonomy_field_is_empty (taxonomy module has weight 0) but still it did not help
So I need to alter $items value in hook_field_widget_form in a way that taxonomy_field_is_empty($item,$field) gets $item value such that $item['tid'] is defined(which was not case due to $item['0']['tid'] )

Is there any way I can alter $item value in hook_field_is_empty ?
Altering taxonomy_field_is_empty's behavior is, by definition, altering core, so the answer is no. Hacking core shouldn't be done (unless there's a clear what &amp; why you're doing the hacking).

With that said, you should follow back on your original problem:


  I tried adding a custom hook in my module for hook_field_is_empty but it did not execute the hook at all ,even I tried adding -1 weight so it executes before taxonomy_field_is_empty (taxonomy module has weight 0) but still it did not help 


The problem is, for some reason, your module's hook_field_is_empty implementation isn't firing so you'll need to troubleshoot that problem. 

Look at other module implementations of the hook to see what those are doing that your module isn't and throw debug statements into module_invoke_all to see if your module's hook is even recognized by core.