I’m trying to get a list with all registered sidebars using $wp_registered_sidebars but it returns an empty array.
Here is my code:
foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar)
{
$sidebar_options[$sidebar['id']] = $sidebar['name'];
}
It returns Array()
In a page template it works, but not in my functions.php
Any idea?
Thanks
put this function in your theme functions.php
and call this function as usual as
get_my_widgets();
to get the registered sidebar listadd the following function in your theme functions.php
and call it as
my_sidebar_selectbox();
it is working to me