From e2c7f8d96ef33ae5452b62669e0ea5eaa0da769f Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 20 Mar 2015 18:30:27 +0000 Subject: [PATCH] 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 --- wp-includes/widgets.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 40bf54c528..7c282c52d7 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -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",