WP_Error::get_error_message( string|int $code = '' ): string

Gets a single error message.


Description

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


Top ↑

Parameters

$code string|int Optional
Error code to retrieve the message for.

Default: ''


Top ↑

Return

string The error message.


Top ↑

Source

File: wp-includes/class-wp-error.php. View all references

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];
}


Top ↑

Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes

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