• Resolved juliamb

    (@juliamb)


    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)

    (@bruceallen)

    Happiness Engineer

    Hi @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. If you choose to reach out directly, please include a link to this thread.

    Thanks!

    Plugin Support Jen H. (a11n)

    (@jennywp)

    Hey @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.