For string fields, records the maximum string length that field can safely save.
$dataarrayrequired
...$0 arrayvalue mixedformat stringcharset string|false$tablestringrequired
...$0 arrayvalue mixedformat stringcharset string|falselength array|falsetype string'byte' or 'char'.length intprotected function process_field_lengths( $data, $table ) {
foreach ( $data as $field => $value ) {
if ( '%d' === $value['format'] || '%f' === $value['format'] ) {
/*
* We can skip this field if we know it isn't a string.
* This checks %d/%f versus ! %s because its sprintf() could take more.
*/
$value['length'] = false;
} else {
$value['length'] = $this->get_col_length( $table, $field );
if ( is_wp_error( $value['length'] ) ) {
return false;
}
}
$data[ $field ] = $value;
}
return $data;
}
| Version | Description |
|---|---|
| 4.2.1 | Introduced. |
You must log in before being able to contribute a note or feedback.
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wpdb/process_field_lengths