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

props stephenharris.
fixes #28092.

Built from https://develop.svn.wordpress.org/trunk@29854


git-svn-id: http://core.svn.wordpress.org/trunk@29617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Kovshenin 2014-10-08 07:12:18 +00:00
parent 98ff88518a
commit 2b88252b38

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 ] );
}
}
/**