HTTP/2 301
server: nginx
date: Tue, 14 Oct 2025 03:22:47 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
vary: accept, content-type
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/classes/wpdb/process_field_charsets/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
HTTP/2 200
server: nginx
date: Tue, 14 Oct 2025 03:22:48 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
wpdb::process_field_charsets() – Method | Developer.WordPress.org
WordPress Developer Resources
wpdb::process_field_charsets()
wpdb::process_field_charsets( array $data , string $table ): array|false
$data
array required Array of values and formats keyed by their field names, as it comes from the wpdb::process_field_formats() method.
...$0
array Value and format for this field.
$table
string required Table name.
array|false The same array of data with additional ‘charset’ keys, or false if the charset for the table cannot be found.
...$0
array Value, format, and charset for this field.
value
mixed The value to be formatted.
format
string The format to be mapped to the value.
charset
string|false The charset to be used for the value.
protected function process_field_charsets( $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['charset'] = false;
} else {
$value['charset'] = $this->get_col_charset( $table, $field );
if ( is_wp_error( $value['charset'] ) ) {
return false;
}
}
$data[ $field ] = $value;
}
return $data;
}
View all references View on Trac View on GitHub
Version Description 4.2.0 Introduced.
User Contributed Notes
You must log in before being able to contribute a note or feedback.