diff --git a/src/wp-admin/plugins.php b/src/wp-admin/plugins.php
index 62e904accaac2..700f5b2688ebd 100644
--- a/src/wp-admin/plugins.php
+++ b/src/wp-admin/plugins.php
@@ -690,6 +690,12 @@
$errmsg = __( 'Plugin could not be activated because it triggered a fatal error.' );
}
+ $error_notice_args = array(
+ 'id' => 'message',
+ 'additional_classes' => array( 'error' ),
+ );
+ $allowed_html = wp_kses_allowed_html( 'post' );
+
if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] )
&& isset( $_GET['_error_nonce'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin )
) {
@@ -703,16 +709,21 @@
);
$errmsg .= '';
+
+ // wp_kses_post() strips iframes, so allow this one when sanitizing this notice only.
+ $allowed_html['iframe'] = array(
+ 'src' => true,
+ 'style' => true,
+ 'width' => true,
+ 'height' => true,
+ );
}
- wp_admin_notice(
- $errmsg,
- array(
- 'id' => 'message',
- 'additional_classes' => array( 'error' ),
- )
- );
+ /** This action is documented in wp-includes/functions.php */
+ do_action( 'wp_admin_notice', $errmsg, $error_notice_args );
+ // Same as wp_admin_notice(), but sanitized with the allowed HTML above instead of wp_kses_post().
+ echo wp_kses( wp_get_admin_notice( $errmsg, $error_notice_args ), $allowed_html );
} elseif ( isset( $_GET['deleted'] ) ) {
$delete_result = get_option( 'plugins_delete_result_' . $user_ID );
// Delete it once we're done.