Title: post_views_count returns 0
Last modified: August 24, 2016

---

# post_views_count returns 0

 *  [anbu369](https://wordpress.org/support/users/anbu369/)
 * (@anbu369)
 * [11 years ago](https://wordpress.org/support/topic/post_views_count-returns-0/)
 * Hi I am trying to list authors based on view counts. I got the authors using 
   get_users and the posts using get_posts but when I pass the post id into get_post_meta,
   all it returns is 0.
 *     ```
       $users = get_users('orderby=post_count&order=DESC&who=author&number=10');
       foreach($users as $user)
       {
       	$query = get_posts(array('author' =>  $user->ID) );
   
       		foreach ($query as $post) {
       			$views = absint( get_post_meta( $post->ID, 'post_views_count', true ) );
                   echo $views;
       		}
       }
       ```
   
 * I can see view in my blog for each post but when I go to wp_postmeta table in
   my database, I have only few post_views_count meta keys and all the meta_values
   are 0.
    Am I doing anything wrong?

The topic ‘post_views_count returns 0’ is closed to new replies.

## Tags

 * [count](https://wordpress.org/support/topic-tag/count/)
 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)
 * [views](https://wordpress.org/support/topic-tag/views/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [anbu369](https://wordpress.org/support/users/anbu369/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/post_views_count-returns-0/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
