Title: iterating through array
Last modified: August 20, 2016

---

# iterating through array

 *  Resolved [danixland](https://wordpress.org/support/users/danixland/)
 * (@danixland)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/iterating-through-array/)
 * Hello everybody, I have this code [on pastebin](http://pastebin.com/kNXCCJx9)
   and I’m trying to make it work..
 * if I comment out the `is_active_sidebar` part and print the $count value it returns“
   3” as it should, but if I go for the `is_active_sidebar` (and comment out the
   first `$count++` of course) and I’m sure all 3 widget areas are active it returns“
   1” no matter what I do..
 * Do you see something wrong??
 * thanks in advance!! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/iterating-through-array/#post-2172107)
 * `is_active_sidebar()` must be returning `false`. That suggests that your sidebar
   names are wrong or that you are running the function before the sidebars have
   been initialized. There may be other possibilities as well but those are the 
   ones that come to my mind. Try putting this at the very top of your function 
   and see what you get:
 *     ```
       global $wp_registered_sidebars;
       var_dump($wp_registered_sidebars);
       ```
   
 *  Thread Starter [danixland](https://wordpress.org/support/users/danixland/)
 * (@danixland)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/iterating-through-array/#post-2172233)
 * thanks for your reply apljdi, I have to apologize, it was my mistake since I 
   wasn’t passing the correct ids of my sidebars, so `is_active_sidebar()` was obviously
   returning false..
 * The function works well, so thanks again and sorry for all the noise.. 😉

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘iterating through array’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [is_active_sidebar](https://wordpress.org/support/topic-tag/is_active_sidebar/)

 * 2 replies
 * 2 participants
 * Last reply from: [danixland](https://wordpress.org/support/users/danixland/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/iterating-through-array/#post-2172233)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
