Changeset 49022
- Timestamp:
- 09/20/2020 05:43:00 PM (5 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-error.php
r48586 r49022 57 57 } 58 58 59 $this->errors[ $code ][] = $message; 60 61 if ( ! empty( $data ) ) { 62 $this->error_data[ $code ] = $data; 63 } 59 $this->add( $code, $message, $data ); 64 60 } 65 61 … … 177 173 178 174 /** 179 * Add an error or appendadditional message to an existing error.175 * Adds an error or appends an additional message to an existing error. 180 176 * 181 177 * @since 2.1.0 … … 187 183 public function add( $code, $message, $data = '' ) { 188 184 $this->errors[ $code ][] = $message; 185 189 186 if ( ! empty( $data ) ) { 190 $this->error_data[ $code ] = $data; 191 } 187 $this->add_data( $data, $code ); 188 } 189 190 /** 191 * Fires when an error is added to a WP_Error object. 192 * 193 * @since 5.6.0 194 * 195 * @param string|int $code Error code. 196 * @param string $message Error message. 197 * @param mixed $data Error data. Might be empty. 198 * @param WP_Error $wp_error The WP_Error object. 199 */ 200 do_action( 'wp_error_added', $code, $message, $data, $this ); 192 201 } 193 202 -
trunk/src/wp-includes/load.php
r48941 r49022 1447 1447 1448 1448 /** 1449 * Check whethervariable is a WordPress Error.1450 * 1451 * Returns true if $thing is an object of the WP_Errorclass.1449 * Checks whether the given variable is a WordPress Error. 1450 * 1451 * Returns whether `$thing` is an instance of the `WP_Error` class. 1452 1452 * 1453 1453 * @since 2.1.0 1454 1454 * 1455 * @param mixed $thing Check if unknown variable is a WP_Error object.1456 * @return bool True, if WP_Error. False, if notWP_Error.1455 * @param mixed $thing The variable to check. 1456 * @return bool Whether the variable is an instance of WP_Error. 1457 1457 */ 1458 1458 function is_wp_error( $thing ) { 1459 return ( $thing instanceof WP_Error ); 1459 $is = ( $thing instanceof WP_Error ); 1460 1461 if ( $is ) { 1462 /** 1463 * Fires when `is_wp_error()` is called and it's an instance of `WP_Error`. 1464 * 1465 * @since 5.6.0 1466 * 1467 * @param WP_Error $thing The error object passed to `is_wp_error()`. 1468 */ 1469 do_action( 'wp_error_checked', $thing ); 1470 } 1471 1472 return $is; 1460 1473 } 1461 1474
Note: See TracChangeset
for help on using the changeset viewer.