Title: Variable Not Working Inside is_author() Array
Last modified: August 21, 2016

---

# Variable Not Working Inside is_author() Array

 *  Resolved [chazbeaner](https://wordpress.org/support/users/chazbeaner/)
 * (@chazbeaner)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/variable-not-working-inside-is_author-array/)
 * I’m using a plugin (User Groups) to separate out users into, well, groups, and
   I need to figure out a way to create a conditional to check if an author is in
   a certain group. So, using get_term_by and get_objects_in_term, I was able to
   build a string of author IDs. See below:
 *     ```
       $taxonomy = 'user-group';
       $taxonomy_group_name = 'author-group';
       $taxonomy_group_id = get_term_by('slug' , $taxonomy_group_name, $taxonomy, 'OBJECT');
       $taxonomy_group_ids = get_objects_in_term($taxonomy_group_id->term_id, $taxonomy);
       $taxonomy_id_list = implode(',', $taxonomy_group_ids);
       ```
   
 * So, I can take the list stored in $taxonomy_id_list and echo it out and get a
   string that looks like the below:
 * `1,2,3,4,5,6,7`
 * For the conditional, I should then be able to say:
 * `if(is_author(array($taxonomy_id_list))) { }`
 * But that doesn’t work. If I paste the raw list into the array, it works as it
   should, but if I try to use the variable inside the array, the conditional does
   not work.
 * What am I missing? Why wouldn’t that variable work?

Viewing 1 replies (of 1 total)

 *  Thread Starter [chazbeaner](https://wordpress.org/support/users/chazbeaner/)
 * (@chazbeaner)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/variable-not-working-inside-is_author-array/#post-3945783)
 * Figured it out, can use the array defined one step earlier:
 * `is_author($taxonomy_group_ids)`
 * [http://stackoverflow.com/questions/1125730/how-can-i-split-a-comma-delimited-string-into-an-array-in-php](http://stackoverflow.com/questions/1125730/how-can-i-split-a-comma-delimited-string-into-an-array-in-php)

Viewing 1 replies (of 1 total)

The topic ‘Variable Not Working Inside is_author() Array’ is closed to new replies.

## Tags

 * [author](https://wordpress.org/support/topic-tag/author/)
 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [is_author](https://wordpress.org/support/topic-tag/is_author/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 1 participant
 * Last reply from: [chazbeaner](https://wordpress.org/support/users/chazbeaner/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/variable-not-working-inside-is_author-array/#post-3945783)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
