Trigger `_doing_it_wrong()` if `register_sidebar()` is not passed an `id`

* If you don't pass an `id`, WP sets an auto-increment one for you.
* But this depends on order of sidebar definition.
* Change the order or remove a sidebar? They jumble.

fixes #31675
props tschutter, valendesigns
Built from https://develop.svn.wordpress.org/trunk@31850


git-svn-id: http://core.svn.wordpress.org/trunk@31829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2015-03-20 18:30:27 +00:00
parent a7eedc5f23
commit e2c7f8d96e
1 changed files with 4 additions and 0 deletions

View File

@ -803,6 +803,10 @@ function register_sidebar($args = array()) {
$i = count($wp_registered_sidebars) + 1;
if ( empty( $args['id'] ) ) {
_doing_it_wrong( __FUNCTION__, sprintf( __( 'You should set %s in the arguments array.' ), 'id' ), '4.2.0' );
}
$defaults = array(
'name' => sprintf(__('Sidebar %d'), $i ),
'id' => "sidebar-$i",