[wp-trac] [WordPress Trac] #22116: bug in dynamic_sidebar function

WordPress Trac wp-trac at lists.automattic.com
Sat Oct 6 12:19:48 UTC 2012


#22116: bug in dynamic_sidebar function
-----------------------------+--------------------------
 Reporter:  alexvorn2        |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Widgets
  Version:  3.4.2            |   Severity:  major
 Keywords:                   |
-----------------------------+--------------------------
 In the dynamic_sidebar function is for displaying the right sidebar, by
 id, but in the code it is searched by name:


 {{{
 function dynamic_sidebar($index = 1) {
         global $wp_registered_sidebars, $wp_registered_widgets;

         if ( is_int($index) ) {
                 $index = "sidebar-$index";
         } else {
                 $index = sanitize_title($index);
                 foreach ( (array) $wp_registered_sidebars as $key =>
 $value ) {
                         if ( sanitize_title($value['name']) == $index ) {
                                 $index = $key;
                                 break;
                         }
                 }
         }


 }}}

 must be changed to :

 {{{

 function dynamic_sidebar($index = 1) {
         global $wp_registered_sidebars, $wp_registered_widgets;

         if ( is_int($index) ) {
                 $index = "sidebar-$index";
         } else {
                 $index = sanitize_title($index);
                 foreach ( (array) $wp_registered_sidebars as $key =>
 $value ) {
                         if ( sanitize_title($value['id']) == $index ) {
                                 $index = $key;
                                 break;
                         }
                 }
         }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22116>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list