Bulk_Upgrader_Skin::error() WordPress Method

The Bulk_Upgrader_Skin::error() method is used to display an error message during the bulk upgrade process. This can be used to display an error message when the upgrade process fails, or to display a warning message when the process is successful but there were some errors.

Bulk_Upgrader_Skin::error( string|WP_Error $errors ) #


Parameters

$errors

(string|WP_Error)(Required)Errors.


Top ↑

Source

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

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

		if ( is_wp_error( $errors ) ) {
			$messages = array();
			foreach ( $errors->get_error_messages() as $emessage ) {
				if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) {
					$messages[] = $emessage . ' ' . esc_html( strip_tags( $errors->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>';
	}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.