Title: passing a variable to is_category array
Last modified: August 19, 2016

---

# passing a variable to is_category array

 *  [stevecoy](https://wordpress.org/support/users/stevecoy/)
 * (@stevecoy)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/passing-a-variable-to-is_category-array/)
 * This seems like it should be so simple. I want my archive pages to display different
   things if we’re in a certain group of categories. AND I want to be able to define
   these categories as part of wp_options. So, I have:
 * <?php $featuredcats = get_option(‘featuredcats’);
    if (is_category(array($featuredcats))){?
   >
 * do some stuff
 * <?php } else {?>
 * do some different stuff
 * <?php }?>
 * In my case, the value of $featuredcats is 4,5,6,7,8–when I echo it, I get: 4,5,6,7,8
 * But it’s not being accepted as an array. If $featuredcats is a single integer,
   it works fine. But when I try entering comma-separated integers, it doesn’t work.
   I’ve tried exploding/imploding it, i doesn’t make a difference. Surely is_category
   must be able to accept a variable?????

The topic ‘passing a variable to is_category array’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [stevecoy](https://wordpress.org/support/users/stevecoy/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/passing-a-variable-to-is_category-array/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
