From 19b035f04bc2d87eae6be770242fda18fa4d70f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helen=20Hou-Sand=C3=AD?= Date: Tue, 10 Nov 2020 20:40:09 +0000 Subject: [PATCH] Widgets: Do not use wrapping container in the admin. This is due to the new `before|after_sidebar` args, which are empty by default, but can introduce markup that causes admin JS to stop working. Also adds documentation for the `sprintf()` on `before_sidebar`. Props audrasjb, lpointet. See #19709. Built from https://develop.svn.wordpress.org/trunk@49560 git-svn-id: http://core.svn.wordpress.org/trunk@49298 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/widgets.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 6bfc394cbd..77ac5c1eb1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-beta3-49559'; +$wp_version = '5.6-beta3-49560'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index a7f54d697b..b30452e1fd 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -243,6 +243,7 @@ function register_sidebars( $number = 1, $args = array() ) { * @type string $after_title HTML content to append to the sidebar title when displayed. * Default is a closing h2 element. * @type string $before_sidebar HTML content to prepend to the sidebar when displayed. + * Receives the '$id' argument as %1$s and '$class' as %2$s. * Outputs after the {@see 'dynamic_sidebar_before'} action. * Default empty string. * @type string $after_sidebar HTML content to append to the sidebar when displayed. @@ -718,7 +719,7 @@ function dynamic_sidebar( $index = 1 ) { */ do_action( 'dynamic_sidebar_before', $index, true ); - if ( ! empty( $sidebar['before_sidebar'] ) ) { + if ( ! is_admin() && ! empty( $sidebar['before_sidebar'] ) ) { echo $sidebar['before_sidebar']; } @@ -823,7 +824,7 @@ function dynamic_sidebar( $index = 1 ) { } } - if ( ! empty( $sidebar['after_sidebar'] ) ) { + if ( ! is_admin() && ! empty( $sidebar['after_sidebar'] ) ) { echo $sidebar['after_sidebar']; }