W3cubDocs

/WordPress

Bulk_Upgrader_Skin::error( string|WP_Error $error )

Parameters

$error

(string|WP_Error) (Required)

Source

File: wp-admin/includes/class-bulk-upgrader-skin.php

public function error( $error ) {
		if ( is_string( $error ) && isset( $this->upgrader->strings[ $error ] ) ) {
			$this->error = $this->upgrader->strings[ $error ];
		}

		if ( is_wp_error( $error ) ) {
			$messages = array();
			foreach ( $error->get_error_messages() as $emessage ) {
				if ( $error->get_error_data() && is_string( $error->get_error_data() ) ) {
					$messages[] = $emessage . ' ' . esc_html( strip_tags( $error->get_error_data() ) );
				} else {
					$messages[] = $emessage;
				}
			}
			$this->error = implode( ', ', $messages );
		}
		echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js( $this->upgrader->update_current ) . '\').hide();</script>';
	}

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/bulk_upgrader_skin/error