Uses
Uses | Description |
---|---|
wp-includes/load.php: is_wp_error() | Check whether variable is a WordPress Error. |
Stores a log entry for an error.
(string|WP_Error) (Required) Errors.
(mixed) (Optional) text replacements.
File: wp-admin/includes/class-wp-ajax-upgrader-skin.php
public function error( $errors, ...$args ) { if ( is_string( $errors ) ) { $string = $errors; if ( ! empty( $this->upgrader->strings[ $string ] ) ) { $string = $this->upgrader->strings[ $string ]; } if ( false !== strpos( $string, '%' ) ) { if ( ! empty( $args ) ) { $string = vsprintf( $string, $args ); } } // Count existing errors to generate a unique error code. $errors_count = count( $this->errors->get_error_codes() ); $this->errors->add( 'unknown_upgrade_error_' . ( $errors_count + 1 ), $string ); } elseif ( is_wp_error( $errors ) ) { foreach ( $errors->get_error_codes() as $error_code ) { $this->errors->add( $error_code, $errors->get_error_message( $error_code ), $errors->get_error_data( $error_code ) ); } } parent::error( $errors, ...$args ); }
Version | Description |
---|---|
5.3.0 | Formalized the existing ...$args parameter by adding it to the function signature. |
4.6.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_ajax_upgrader_skin/error