From 490fb1bf52db4f17c59a37313d3247f3f56f5f1d Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 20 Mar 2015 18:29:13 +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 git-svn-id: https://develop.svn.wordpress.org/trunk@31850 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/widgets.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php index 40bf54c528..7c282c52d7 100644 --- a/src/wp-includes/widgets.php +++ b/src/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",