get_user_fields_keys() ); } function documentation(){ $fields = $this->get_user_fields(); ?> .

In fields of type relationships, you can use post slug or post ID in the list of posts related.

get_user_fields_types(); foreach ( $types as $key => $type ) { $pos = array_search( $key, $headers ); if( $pos === FALSE ) continue; $fields_positions[ $pos ] = $key; } foreach ( $fields_positions as $pos => $key ) { if( $types[ $key ][ 'type' ] == 'relationship' ){ $data = explode( ',', $row[ $pos ] ); foreach ( $data as $it => $value ) { $data[ $it ] = is_numeric( $value ) ? $value : ACUI_Helper::get_post_id_by_slug( $value ); } } elseif( $types[ $key ][ 'type' ] == 'image' ){ $data = media_sideload_image( $row[ $pos ], 0, $key . ' of user ' . $user_id, 'id' ); } elseif( $types[ $key ][ 'multiple' ] ){ $data = explode( ',', $row[ $pos ] ); array_filter( $data, function( $value ){ return $value !== ''; } ); } else{ $data = $row[ $pos ]; } update_field( $key, $data, "user_" . $user_id ); } } function export_columns( $row ){ foreach( $this->get_fields_with_url() as $field ){ $row[ $field . "_url" ] = $field . "_url"; } return $row; } function export_data( $row, $user ){ foreach( $this->get_fields_with_url() as $field ){ $row[] = wp_get_attachment_url( get_user_meta( $user, $field, true ) ); } return $row; } function get_user_fields(){ $fields = array(); $field_groups = acf_get_field_groups( array( 'user_id' => 'new', 'user_form' => '#your-profile' ) ); if( empty( $field_groups ) ) return array(); foreach( $field_groups as $field_group ) { $fields[ $field_group['title'] ] = acf_get_fields( $field_group ); } return $fields; } function get_user_fields_keys(){ $fields = $this->get_user_fields(); $fields_keys = array(); if( empty( $fields ) ) return array(); foreach ( $fields as $group => $fields_of_group ){ foreach ( $fields_of_group as $field ){ $fields_keys[] = $field['name']; } } return $fields_keys; } function get_user_fields_types(){ $fields = $this->get_user_fields(); $fields_keys = array(); $types_multiple = array( 'select', 'checkbox', 'radio', 'button_group' ); if( empty( $fields ) ) return array(); foreach ( $fields as $group => $fields_of_group ){ foreach ( $fields_of_group as $field ){ $fields_keys[ $field['name'] ] = [ 'type' => $field['type'], 'multiple' => !empty( $field['multiple'] ) || ( !isset( $field['multiple'] ) && in_array( $field['type'], $types_multiple ) ), ]; } } return $fields_keys; } function get_fields_with_url(){ $fields = array(); foreach( $this->get_user_fields_types() as $key => $field ){ if( in_array( $field['type'], array( 'image', 'file', 'image_aspect_ratio_crop' ) ) ) $fields[] = $key; } return $fields; } } new ACUI_ACF();