WordPress at a glance
function is not described

wpdb::process_fields() protected WP 4.2.0

Processes arrays of field/value pairs and field formats.

This is a helper method for wpdb's CRUD methods, which take field/value pairs for inserts, updates, and where clauses. This method first pairs each value with a format. Then it determines the charset of that field, using that to determine if any invalid text would be stripped. If text is stripped, then field processing is rejected and the query fails.

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

No Hooks.


Array|false. An array of fields that contain paired value and formats. False for invalid values.


// protected - for code of main (parent) or child class
$result = $this->process_fields( $table, $data, $format );
$table(string) (required)
Table name.
$data(array) (required)
Field/value pair.
$format(mixed) (required)
Format for each field.


Since 4.2.0 Introduced.

Code of wpdb::process_fields() WP 5.7.2

protected function process_fields( $table, $data, $format ) {
	$data = $this->process_field_formats( $data, $format );
	if ( false === $data ) {
		return false;

	$data = $this->process_field_charsets( $data, $table );
	if ( false === $data ) {
		return false;

	$data = $this->process_field_lengths( $data, $table );
	if ( false === $data ) {
		return false;

	$converted_data = $this->strip_invalid_text( $data );

	if ( $data !== $converted_data ) {
		return false;

	return $data;