WordPress at a glance
функция не описана

wpdb::process_field_formats() protected WP 4.2.0

Prepares arrays of value/format pairs as passed to wpdb CRUD methods.

It's a method of the class: wpdb{}

Хуков нет.

Возвращает

Array. Array, keyed by field names with values being an array of 'value' and 'format' keys.

Использование

// protected - for code of main (parent) or child class
$result = $this->process_field_formats( $data, $format );
$data(array) (required)
Array of fields to values.
$format(mixed) (required)
Formats to be mapped to the values in $data.

Changelog

Since 4.2.0 Introduced.

Код wpdb::process_field_formats() WP 5.5.1

<?php
protected function process_field_formats( $data, $format ) {
	$formats          = (array) $format;
	$original_formats = $formats;

	foreach ( $data as $field => $value ) {
		$value = array(
			'value'  => $value,
			'format' => '%s',
		);

		if ( ! empty( $format ) ) {
			$value['format'] = array_shift( $formats );
			if ( ! $value['format'] ) {
				$value['format'] = reset( $original_formats );
			}
		} elseif ( isset( $this->field_types[ $field ] ) ) {
			$value['format'] = $this->field_types[ $field ];
		}

		$data[ $field ] = $value;
	}

	return $data;
}