From 05cd8a447e832f0ba83425923b9626706dbf56f1 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 13 Oct 2015 01:49:48 +0000 Subject: [PATCH] Widgets: When using `the_widget()`, the `$before_widget` argument only receives the widget class if using the default sidebar arguments. Run `sprintf` after parsing the args to fix this. Adds unit test. Props coffee2code. Fixes #19450. Built from https://develop.svn.wordpress.org/trunk@35106 git-svn-id: http://core.svn.wordpress.org/trunk@35071 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/widget-functions.php | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 5541791e77..fcb46cebc7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35105'; +$wp_version = '4.4-alpha-35106'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widget-functions.php b/wp-includes/widget-functions.php index 8c9b568935..c9c8268a5e 100644 --- a/wp-includes/widget-functions.php +++ b/wp-includes/widget-functions.php @@ -949,10 +949,15 @@ function the_widget( $widget, $instance = array(), $args = array() ) { return; } - $before_widget = sprintf('
', $widget_obj->widget_options['classname'] ); - $default_args = array( 'before_widget' => $before_widget, 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

' ); + $default_args = array( + 'before_widget' => '
', + 'after_widget' => "
", + 'before_title' => '

', + 'after_title' => '

', + ); + $args = wp_parse_args( $args, $default_args ); + $args['before_widget'] = sprintf( $args['before_widget'], $widget_obj->widget_options['classname'] ); - $args = wp_parse_args($args, $default_args); $instance = wp_parse_args($instance); /**