WP_Error::get_error_code() WordPress Method

The WP_Error::get_error_code() method is used to get the first error code from a WP_Error object.

WP_Error::get_error_code() #

Retrieves the first error code available.


Return

(string|int) Empty string, if no error codes.


Top ↑

Source

File: wp-includes/class-wp-error.php

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

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

		return $codes[0];
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

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.