ACF_Data::set │ public │ ACF 5.7.10

set

Sets data for the given name and returns $this for chaining.

Method of the class: ACF_Data{}

No Hooks.

Returns

ACF_Data.

Usage

$ACF_Data = new ACF_Data();
$ACF_Data->set( $name, $value );
$name((string|array))
The data name or an array of data.
Default: ''
$value(mixed)
The data value.
Default: null

Changelog

Since 5.7.10 Introduced.

ACF_Data::set() code ACF 6.8.8

function set( $name = '', $value = null ) {

	// Set multiple.
	if ( is_array( $name ) ) {
		$this->data = array_merge( $this->data, $name );

		// Set single.
	} else {
		$this->data[ $name ] = $value;
	}

	// Return this for chaining.
	return $this;
}