[wp-trac] [WordPress Trac] #14548: registered sidebars with capital letter in the ID don't get loaded

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 6 01:53:58 UTC 2010


#14548: registered sidebars with capital letter in the ID don't get loaded
--------------------------+-------------------------------------------------
 Reporter:  wjm           |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Widgets       |     Version:  3.0            
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 if you use register_sidebar() and set ID to have a capital letter, it will
 be displayed in the widgets section but its widgets won't get loaded.


 {{{
 register_sidebar(array(
 'name' => 'RightSideBar',
 'id' => 'Rsidebar',
 ));
 }}}
 it won't work but


 while...
 {{{
 register_sidebar(array(
 'name' => 'RightSideBar',
 'id' => 'rsidebar',
 ));
 }}}
 ... will work.

 This has to do with dynamic_sidebar() using sanitize_title() to sanitize
 the id,
 the thing is that sanitize_title() (which calls
 sanitize_title_with_dashes()) will turn every upper case to a lower case,
 and later it will look in $wp_registered_sidebars for the key which is
 non-existant.

 This patch sanitizes the sidebar ID at the time of registering it,
 so using
 'id' => 'Rsidebar',
 or
 'id' => 'rsidebar',

 registers the same sidebar.

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


More information about the wp-trac mailing list