wp_xmlrpc_server::error() WordPress Method

The wp_xmlrpc_server::error() method is used to return an error message from the XML-RPC server. This is useful for debugging purposes.

wp_xmlrpc_server::error( IXR_Error|string $error, false $message = false ) #

Send error response to client.


Description

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


Top ↑

Parameters

$error

(IXR_Error|string)(Required)Error code or an error object.

$message

(false)(Optional)Error message. Optional.

Default value: false


Top ↑

Source

File: wp-includes/class-wp-xmlrpc-server.php

	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() );
	}


Top ↑

Changelog

Changelog
VersionDescription
5.7.3Introduced.

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.

Show More
Show More