Make WordPress Core

Changeset 29854


Ignore:
Timestamp:
10/08/2014 07:11:09 AM (11 years ago)
Author:
kovshenin
Message:

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

props stephenharris.
fixes #28092.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-error.php

    r29454 r29854  
    242242
    243243        $this->error_data[$code] = $data;
     244    }
     245   
     246    /**
     247     * Removes the specified error.
     248     *
     249     * This function removes all error messages associated with the specified
     250     * error code, along with any error data for that code.
     251     *
     252     * @since 4.1.0
     253     *
     254     * @param string|int $code Error code.
     255     */
     256    public function remove( $code ) {
     257        unset( $this->errors[ $code ] );
     258        unset( $this->error_data[ $code ] );
    244259    }
    245260}
Note: See TracChangeset for help on using the changeset viewer.