wpdb::process_field_charsets() WordPress Method
The wpdb::process_field_charsets() method is used to process the character set of a field in a WordPress database. This is used when creating or updating a database field to ensure that the field is properly encoded.
wpdb::process_field_charsets( array $data, string $table ) #
Adds field charsets to field/value/format arrays generated by wpdb::process_field_formats().
Parameters
- $data
(array)(Required)As it comes from the wpdb::process_field_formats() method.
- $table
(string)(Required)Table name.
Return
(array|false) The same array as $data with additional 'charset' keys. False on failure.
Source
File: wp-includes/wp-db.php
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.2.0 | Introduced. |