WP_Error::get_error_message

Advertisement

Summery Summery

Get single error message.

Syntax Syntax

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

Description Description

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

Parameters Parameters

$code

(string|int) (Optional) Error code to retrieve message.

Default value: ''

Return Return

(string)

Source Source

File: wp-includes/class-wp-error.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];
	}

Advertisement

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

What are you looking for?