mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 18:54:29 +00:00
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:
@@ -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 ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user