Anbieternummer zu jedem Objekt speichern

/**
 * Anbieternummer jeweils beim Start des Importvorgangs zwischenspeichern (als globale Variable)
 */
function mysite_set_current_agency_number( $anbieter ) {
  global $mysite_current_agency_number;
 
  if ( isset( $anbieter->anbieternr ) ) {
    $mysite_current_agency_number = (string) $anbieter->anbieternr;
  }
 
  return $anbieter;
}
add_filter( 'immonex_oi2wp_import_agency_xml_before_import', 'mysite_set_current_agency_number' );
 
/**
 * Aktuelle Anbieternummer (globale Variable) als Custom Field `property_agent` zu der Immobilie speichern
 */
function mysite_update_property_agent( $post_id, $immobilie ) {
  global $mysite_current_agency_number;
 
  if ( isset( $anbieter->anbieternr ) ) {
    update_post_meta( $post_id, 'property_agent', $mysite_current_agency_number );
  }
} 
add_action( 'immonex_oi2wp_property_imported', 'mysite_update_property_agent', 90, 2 );

Für Theme WP Residence.