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.