WP_Error::has_errors() WordPress Method

The WP_Error::has_errors() method is used to check whether a given WordPress error object has any errors. This is useful for checking whether an error has occurred before attempting to get the error message.

WP_Error::has_errors() #

Verifies if the instance contains errors.


Return

(bool) If the instance contains errors.


Top ↑

Source

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

	public function has_errors() {
		if ( ! empty( $this->errors ) ) {
			return true;
		}
		return false;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.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.