Automatic_Upgrader_Skin::feedback() WordPress Method

The Automatic_Upgrader_Skin::feedback() method is used to give feedback to the user about the Automatic Upgrader process. The method takes two parameters: $args and $string. $args is an array of arguments that can be used to customize the output, while $string is the feedback string to be outputted.

Automatic_Upgrader_Skin::feedback( string|array|WP_Error $feedback, mixed $args ) #

Stores a message about the upgrade.


Parameters

$feedback

(string|array|WP_Error)(Required)Message data.

$args

(mixed)(Optional)text replacements.


Top ↑

Source

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

	public function feedback( $feedback, ...$args ) {
		if ( is_wp_error( $feedback ) ) {
			$string = $feedback->get_error_message();
		} elseif ( is_array( $feedback ) ) {
			return;
		} else {
			$string = $feedback;
		}

		if ( ! empty( $this->upgrader->strings[ $string ] ) ) {
			$string = $this->upgrader->strings[ $string ];
		}

		if ( strpos( $string, '%' ) !== false ) {
			if ( ! empty( $args ) ) {
				$string = vsprintf( $string, $args );
			}
		}

		$string = trim( $string );

		// Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
		$string = wp_kses(
			$string,
			array(
				'a'      => array(
					'href' => true,
				),
				'br'     => true,
				'em'     => true,
				'strong' => true,
			)
		);

		if ( empty( $string ) ) {
			return;
		}

		$this->messages[] = $string;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Renamed $data to $feedback for PHP 8 named parameter support.
3.7.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.