New remove() method and some unit tests for the WP_Error class.

props stephenharris.
fixes #28092.


git-svn-id: https://develop.svn.wordpress.org/trunk@29854 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Kovshenin
2014-10-08 07:11:09 +00:00
parent eb39c8f75d
commit 6eea081457
2 changed files with 78 additions and 0 deletions

View File

@@ -242,6 +242,21 @@ class WP_Error {
$this->error_data[$code] = $data;
}
/**
* Removes the specified error.
*
* This function removes all error messages associated with the specified
* error code, along with any error data for that code.
*
* @since 4.1.0
*
* @param string|int $code Error code.
*/
public function remove( $code ) {
unset( $this->errors[ $code ] );
unset( $this->error_data[ $code ] );
}
}
/**