FIX: WordPress Notice: register_sidebar was called incorrectly
Make it go away.
I was having WordPress problems, so I turned on debugging. To enable debugging, you can add the following line to wp-config.php in your root directory.
define( 'WP_DEBUG', true );
With debugging on I was getting this error on my home page:
Notice: register_sidebar was called incorrectly. No id was set in the arguments array for the "Sidebar" sidebar. Defaulting to "sidebar-1". Manually set the id to "sidebar-1" to silence this notice and keep existing sidebar content. Please see Debugging in WordPress for more information. (This message was added in version 4.2.0.) in /home/mydomainname/wp-includes/functions.php on line 5313
To fix the problem open the functions.php file in your currently active theme. Look under ./wp-content/themes/YourThemeNameGoesHere/ for the functions.php file.
In this block of code:
Your specific theme may look different, but the idea will be the same. Add an ‘id’ line of code after the ‘name’ line like this:
If you have additional calls to the register_sidebar function, then you’ll have to location those code blocks and add the ‘id’ line to each remembering to increment the id names or give them unique names.
When you’re done, shut off debugging in wp-config.php with the following.
define( 'WP_DEBUG', false );
Hope that helps you!
No Comments >