wp_xmlrpc_server::error()publicWP 5.7.3

Sends error response to client.

Sends an XML error response to the client. If the endpoint is enabled an HTTP 200 response is always sent per the XML-RPC specification.

Method of the class: wp_xmlrpc_server{}

No Hooks.

Return

null. Nothing (null).

Usage

$wp_xmlrpc_server = new wp_xmlrpc_server();
$wp_xmlrpc_server->error( $error, $message );
$error(IXR_Error|string) (required)
Error code or an error object.
$message(false)
Error message. Optional.
Default: false

Changelog

Since 5.7.3 Introduced.

wp_xmlrpc_server::error() code WP 6.5.3

public function error( $error, $message = false ) {
	// Accepts either an error object or an error code and message
	if ( $message && ! is_object( $error ) ) {
		$error = new IXR_Error( $error, $message );
	}

	if ( ! $this->is_enabled ) {
		status_header( $error->code );
	}

	$this->output( $error->getXml() );
}