Title: Undefined Variable issue while using Transients
Last modified: August 31, 2016

---

# Undefined Variable issue while using Transients

 *  [Gabfire](https://wordpress.org/support/users/gabfire/)
 * (@gabfire)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-issue-while-using-transients/)
 * Hi,
 * This is the code
 *     ```
       if ( ( $popular = get_transient( $gabfire_popular_week ) ) === false ) {
       	$popular = stats_get_csv( 'postviews', 'days=7&limit=10' );
       	set_transient('popular_week', $popular, 300);
       }
       ```
   
 * I tried
    if(isset($popular) && is_array($popular) && count($popular) > 0)
 * as well as **isset** and **empty **functions but nothing helped. I do keep getting
   Undefined Variable $popular issue?
 * Anyone can suggest a way to use that code which would prevent that warning?

The topic ‘Undefined Variable issue while using Transients’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [Gabfire](https://wordpress.org/support/users/gabfire/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-issue-while-using-transients/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
