add_action to wp_head is added, but not called

Can we think litter bit different way:

add_action('wp_head','new_wp_head');
function new_wp_head() {
  echo "calling wp_head"; 
  global $civicrm_root;
  if ( empty( $civicrm_root ) ) {
    return;
  }
  $region = CRM_Core_Region::instance('html-header', FALSE);
  if ( $region ) {
    echo '<!-- CiviCRM html header -->';
    echo $region->render( '' );
  }
}

Make sure in which file you put this and it’s hook with your theme or plugins.

error code: 523