mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-06 23:52:28 +01:00
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:
parent
98ff88518a
commit
2b88252b38
@ -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 ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user