I am registering sidebars automatically for each category (a separate widget space per category). The technique I'm using is here.

In the admin side I have an options page where I need to display a dropdown of all registered sidebars... Is there are way to dynamically get this list of registered sidebars? since they're being registered in functions.php I assume they're in memory, not in the database.

I could keep track of the sidebars I register in some global variable, but just in case plugins register their own sidebars, I'd like to account for them too.

I'll dig through the core if I have to, but thought someone might know off-hand:)


1 Answer 1


Hmm... I'm not sure if this is the best way to do it but it's simple:

I looked in register_sidebar() and found that new sidebars are simply tacked onto an array:$wp_registered_sidebars

And I guess that's that. If they ever change the name of the variable, I guess I'd be screwed.

  • 4
    You can always access it via $GLOBALS['wp_registered_sidebars']. In case that changes, you can in your plugin just run a search and replace - and it didn't change since it has been introduced as far as I can remember.
    – hakre
    Jan 1, 2011 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.