WordPress at a glance
function is not described

WP_Error::get_error_code() public WP 2.1.0

Retrieves the first error code available.

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

No Hooks.

Return

String|Int. Empty string, if no error codes.

Usage

$WP_Error = new WP_Error();
$WP_Error->get_error_code();

Changelog

Since 2.1.0 Introduced.

Code of WP_Error::get_error_code() WP 5.7.1

<?php
public function get_error_code() {
	$codes = $this->get_error_codes();

	if ( empty( $codes ) ) {
		return '';
	}

	return $codes[0];
}