wpdb::__construct( string $dbuser, string $dbpassword, string $dbname, string $dbhost )

In this article

Connects to the database server and selects a database.

Description

Does the actual setting up of the class properties and connection to the database.

Parameters

$dbuserstringrequired
Database user.
$dbpasswordstringrequired
Database password.
$dbnamestringrequired
Database name.
$dbhoststringrequired
Database host.

Source

public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
	if ( WP_DEBUG && WP_DEBUG_DISPLAY ) {
		$this->show_errors();
	}

	$this->dbuser     = $dbuser;
	$this->dbpassword = $dbpassword;
	$this->dbname     = $dbname;
	$this->dbhost     = $dbhost;

	// wp-config.php creation will manually connect when ready.
	if ( defined( 'WP_SETUP_CONFIG' ) ) {
		return;
	}

	$this->db_connect();
}

Changelog

VersionDescription
2.0.8Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.