WordPress at a glance
function is not described

WP_Error::get_error_message() public WP 2.1.0

Gets a single error message.

This will get the first message available for the code. If no code is given then the first code available will be used.

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

No Hooks.

Return

String. The error message.

Usage

$WP_Error = new WP_Error();
$WP_Error->get_error_message( $code );
$code(string|int)
Error code to retrieve message.

Changelog

Since 2.1.0 Introduced.

Code of WP_Error::get_error_message() WP 5.7.1

<?php
public function get_error_message( $code = '' ) {
	if ( empty( $code ) ) {
		$code = $this->get_error_code();
	}
	$messages = $this->get_error_messages( $code );
	if ( empty( $messages ) ) {
		return '';
	}
	return $messages[0];
}