diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php index 848249170a..b24b465503 100644 --- a/src/wp-includes/widgets.php +++ b/src/wp-includes/widgets.php @@ -616,9 +616,9 @@ function dynamic_sidebar( $index = 1 ) { if ( is_int( $index ) ) { $index = "sidebar-$index"; } else { - $sanitized_index = sanitize_title( $index ); + $index = sanitize_title( $index ); foreach ( (array) $wp_registered_sidebars as $key => $value ) { - if ( sanitize_title( $value['name'] ) == $sanitized_index ) { + if ( sanitize_title( $value['name'] ) == $index ) { $index = $key; break; } diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php index b864408f62..0ac6d9258d 100644 --- a/tests/phpunit/tests/widgets.php +++ b/tests/phpunit/tests/widgets.php @@ -535,23 +535,6 @@ class Tests_Widgets extends WP_UnitTestCase { $this->assertArrayNotHasKey( 2, $option_value ); } - /** - * @ticket 23423 - */ - function test_dynamic_sidebar_id_special_characters() { - wp_widgets_init(); - register_sidebar( array( - 'name' => 'Sidebar 2', - 'id' => 'sidebar-2', - ) ); - - ob_start(); - $result = dynamic_sidebar( 'Sidebar 1' ); - ob_end_clean(); - - $this->assertFalse( $result ); - } - /** * @see wp_widget_control() */