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

git-svn-id: https://develop.svn.wordpress.org/trunk@31850 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2015-03-20 18:29:13 +00:00
parent 1e4238d6a8
commit 490fb1bf52

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",