WordPress at a glance
function is not described

WP_Error::__construct() public WP 2.1.0

Initializes the error.

If $code is empty, the other parameters will be ignored. When $code is not empty, $message will be used even if it is empty. The $data parameter will be used only if it is not empty.

Though the class is constructed with a single error code and message, multiple codes can be added using the add() method.

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

No Hooks.

Return

null. Null. Nothing.

Usage

$WP_Error = new WP_Error();
$WP_Error->__construct( $code, $message, $data );
$code(string|int)
Error code.
$message(string)
Error message.
$data(mixed)
Error data.

Changelog

Since 2.1.0 Introduced.

Code of WP_Error::__construct() WP 5.7.1

<?php
public function __construct( $code = '', $message = '', $data = '' ) {
	if ( empty( $code ) ) {
		return;
	}

	$this->add( $code, $message, $data );
}