wpdb::__set() WordPress Method

The wpdb::__set() method sets a property of the wpdb class and returns the old value. This is useful for setting a property to a new value and then doing something with the old value, such as setting it back to the original value after doing something else.

wpdb::__set( string $name, mixed $value ) #

Makes private properties settable for backward compatibility.


Parameters

$name

(string)(Required)The private member to set.

$value

(mixed)(Required)The value to set.


Top ↑

Source

File: wp-includes/wp-db.php

	public function __set( $name, $value ) {
		$protected_members = array(
			'col_meta',
			'table_charset',
			'check_current_query',
		);
		if ( in_array( $name, $protected_members, true ) ) {
			return;
		}
		$this->$name = $value;
	}

Top ↑

Changelog

Changelog
VersionDescription
3.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.