From f6fc8025c48509cba63982daae3c99901056840a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 22 Aug 2019 00:22:56 +0000 Subject: [PATCH] Administration: Adjust [45814] to address a backward compatibility issue for plugins passing multiple CSS classes to `add_settings_error()`. Only add the `notice-` prefix for `error`, `success`, `warning`, `info` CSS classes, keep other classes as is. Add unit tests for `settings_errors()`. Props afercia, SergeyBiryukov. Fixes #44941. Built from https://develop.svn.wordpress.org/trunk@45873 git-svn-id: http://core.svn.wordpress.org/trunk@45684 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 10 +++++++--- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index b29123f131..adfda0c982 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1814,13 +1814,17 @@ function settings_errors( $setting = '', $sanitize = false, $hide_on_update = fa $details['type'] = 'success'; } + if ( in_array( $details['type'], array( 'error', 'success', 'warning', 'info' ) ) ) { + $details['type'] = 'notice-' . $details['type']; + } + $css_id = sprintf( 'setting-error-%s', - sanitize_html_class( $details['code'] ) + esc_attr( $details['code'] ) ); $css_class = sprintf( - 'notice notice-%s settings-error is-dismissible', - sanitize_html_class( $details['type'] ) + 'notice %s settings-error is-dismissible', + esc_attr( $details['type'] ) ); $output .= "
\n"; diff --git a/wp-includes/version.php b/wp-includes/version.php index 35515645ac..01612d255e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45872'; +$wp_version = '5.3-alpha-45873'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.