Used By
Used By | Description |
---|---|
wp-includes/wp-db.php: wpdb::process_fields() | Processes arrays of field/value pairs and field formats. |
Prepares arrays of value/format pairs as passed to wpdb CRUD methods.
(array) (Required) Array of fields to values.
(mixed) (Required) Formats to be mapped to the values in $data.
(array) Array, keyed by field names with values being an array of 'value' and 'format' keys.
File: wp-includes/wp-db.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; }
Version | Description |
---|---|
4.2.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wpdb/process_field_formats