Title: &#8216;stats_get_csv&#8217; function returns an empty array
Last modified: May 14, 2021

---

# ‘stats_get_csv’ function returns an empty array

 *  Resolved [juliamb](https://wordpress.org/support/users/juliamb/)
 * (@juliamb)
 * [5 years ago](https://wordpress.org/support/topic/stats_get_csv-function-returns-an-empty-array/)
 * Hi!
 * I’m using this code to obtain the IDs of the most popular posts in a website:
 *     ```
       if ( function_exists( 'stats_get_csv' ) ) {
                $popular = stats_get_csv( 'postviews', array( 'days' => 5, 'limit' => 25 ) );
                $popular_ids = array();
                foreach ( $popular as $p ) {
                   if ( $p['post_id'] != 0  ) {
                      $popular_ids[] = $p['post_id'];
                   }
                }
                $popular_count = count($popular_ids);
             }
       ```
   
 * The problem is that this line is returning an empty array:
 * **`$popular = stats_get_csv( 'postviews', array( 'days' => 5, 'limit' => 25 ));`**
 * This was working fine until a few days ago. The Jetpack plugin is updated and
   activated and I can see the statistics, do you know what could be happening?
 * Thanks, regards.

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

 *  [Bruce (a11n)](https://wordpress.org/support/users/bruceallen/)
 * (@bruceallen)
 * Happiness Engineer
 * [5 years ago](https://wordpress.org/support/topic/stats_get_csv-function-returns-an-empty-array/#post-14439156)
 * Hi [@juliamb](https://wordpress.org/support/users/juliamb/)
 * Could you please post your site URL here so that we can have a look?
 * If you want it to remain private, you can also contact us [via this contact form](https://jetpack.com/contact-support/?rel=support&hpi=1).
   If you choose to reach out directly, please include a link to this thread.
 * Thanks!
 *  Plugin Support [Jen H. (a11n)](https://wordpress.org/support/users/jennywp/)
 * (@jennywp)
 * [5 years ago](https://wordpress.org/support/topic/stats_get_csv-function-returns-an-empty-array/#post-14468270)
 * Hey [@juliamb](https://wordpress.org/support/users/juliamb/),
 * Since it’s been more than a week since we’ve heard from you, I’m going to go 
   ahead and mark this thread as Resolved. If you still need a hand, please feel
   free to reach back out here and mark the thread as `not resolved`.
 * Thanks!

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

The topic ‘‘stats_get_csv’ function returns an empty array’ is closed to new replies.

 * ![](https://ps.w.org/jetpack/assets/icon.svg?rev=2819237)
 * [Jetpack - WP Security, Backup, Speed, & Growth](https://wordpress.org/plugins/jetpack/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jetpack/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jetpack/)
 * [Active Topics](https://wordpress.org/support/plugin/jetpack/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jetpack/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jetpack/reviews/)

## Tags

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

 * 2 replies
 * 3 participants
 * Last reply from: [Jen H. (a11n)](https://wordpress.org/support/users/jennywp/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/stats_get_csv-function-returns-an-empty-array/#post-14468270)
 * Status: resolved