On this page
Automatic_Upgrader_Skin::feedback( string|array|WP_Error $feedback, mixed $args )
Stores a message about the upgrade.
Parameters
$feedbackstring|array|WP_Error Required-
Message data.
$argsmixed Optional-
text replacements.
Source
File: wp-admin/includes/class-automatic-upgrader-skin.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| wp_kses() wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Used By
| Used By | Description |
|---|---|
| WP_Ajax_Upgrader_Skin::feedback() wp-admin/includes/class-wp-ajax-upgrader-skin.php | Stores a message about the upgrade. |
| Automatic_Upgrader_Skin::footer() wp-admin/includes/class-automatic-upgrader-skin.php | Retrieves the buffered content, deletes the buffer, and processes the output. |
Changelog
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/automatic_upgrader_skin/feedback